:root {
  --cyan: #00bfe3;
  --cyan-dark: #0491aa;
  --cyan-pale: #e6f9fd;
  --orange: #fcaa07;
  --yellow: #fdc246;
  --charcoal: #2d3134;
  --ink: #181b1d;
  --muted: #70777d;
  --line: #dfe4e7;
  --surface: #ffffff;
  --canvas: #f4f6f7;
  --danger: #e4523f;
  --green: #0aa880;
  --shadow: 5px 5px 0 rgba(45, 49, 52, 0.11);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); transition: grid-template-columns .24s ease; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 20px;
  color: #fff;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    var(--charcoal);
  background-size: 16px 16px;
  z-index: 10;
  transition: width .24s ease, padding .24s ease;
}
.brand { display: block; padding: 4px 8px 36px; }
.brand img { display: block; width: 176px; height: auto; filter: drop-shadow(0 3px 0 rgba(0,0,0,.22)); }
.brand-coin { display: none !important; }
.sidebar-toggle {
  position: absolute;
  top: 86px;
  right: -16px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 4px solid var(--canvas);
  border-radius: 50%;
  color: var(--charcoal);
  background: var(--cyan);
  box-shadow: 0 7px 18px rgba(20, 31, 35, .2);
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
}
.sidebar-toggle:hover { background: #22c9e7; transform: scale(1.06); }
.sidebar-toggle svg { width: 16px; height: 16px; fill: currentColor; transition: transform .24s ease; }

.app-shell.is-sidebar-collapsed { grid-template-columns: 86px minmax(0, 1fr); }
.app-shell.is-sidebar-collapsed .sidebar { width: 86px; padding-inline: 12px; }
.app-shell.is-sidebar-collapsed .brand { display: grid; place-items: center; width: 62px; height: 54px; padding: 0 5px 6px; }
.app-shell.is-sidebar-collapsed .brand-wordmark { display: none; }
.app-shell.is-sidebar-collapsed .brand-coin { display: block !important; width: 44px; height: 48px; object-fit: contain; filter: none; }
.app-shell.is-sidebar-collapsed .nav-item { justify-content: center; padding-inline: 0; }
.app-shell.is-sidebar-collapsed .nav-item span,
.app-shell.is-sidebar-collapsed .profile-mini > div,
.app-shell.is-sidebar-collapsed .online-dot { display: none; }
.app-shell.is-sidebar-collapsed .profile-mini { display: flex; justify-content: center; padding-inline: 0; }
.app-shell.is-sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.main-nav { display: grid; gap: 8px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  color: #abb3b8;
  background: transparent;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: .18s ease;
}
.nav-item svg { width: 21px; height: 21px; fill: currentColor; }
.main-nav .nav-item svg {
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.065); transform: translateX(2px); }
.nav-item.is-active { color: var(--charcoal); background: var(--cyan); box-shadow: 4px 4px 0 #111416; }
.nav-item.is-active::after { content: ""; position: absolute; right: 8px; width: 5px; height: 5px; background: var(--orange); box-shadow: 4px 0 0 var(--orange), 0 4px 0 var(--orange), 4px 4px 0 var(--orange); }

.profile-mini { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; width: 100%; margin-top: auto; padding: 12px 8px; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; color: var(--charcoal); background: var(--orange); border: 3px solid #16191b; font-weight: 900; box-shadow: 2px 2px 0 var(--cyan); }
.profile-mini strong, .profile-mini span { display: block; }
.profile-mini strong { font-size: 13px; }
.profile-mini div span { margin-top: 2px; color: #8f999e; font-size: 10px; }
.online-dot { width: 7px; height: 7px; background: #1ed69f; box-shadow: 0 0 0 3px rgba(30,214,159,.12); }

.main-area { grid-column: 2; min-width: 0; padding: 32px 42px 48px; }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 64px; margin-bottom: 30px; }
.eyebrow, .section-kicker { margin: 0 0 7px; color: var(--cyan-dark); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: clamp(25px, 2.6vw, 38px); letter-spacing: -.035em; }
.topbar-actions { display: flex; gap: 10px; }
.theme-chip, .sound-chip, .streak-chip, .balance-chip { display: flex; align-items: center; gap: 7px; min-height: 46px; padding: 0 15px; border: 1px solid var(--line); background: #fff; box-shadow: 3px 3px 0 rgba(45,49,52,.08); cursor: pointer; }
.theme-chip span:first-child { font-size: 17px; line-height: 1; }
.theme-chip span:last-child { color: var(--muted); font-size: 12px; }
.sound-chip svg { width: 18px; height: 18px; fill: currentColor; }
.sound-chip span { color: var(--muted); font-size: 12px; }
.sound-chip.is-enabled { color: var(--cyan-dark); background: var(--cyan-pale); border-color: #bdeaf2; }
.streak-chip span:last-child, .balance-chip span:last-child { color: var(--muted); font-size: 12px; }
.pixel-flame { color: var(--orange); text-shadow: 2px 2px 0 var(--charcoal); }

.coin {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  background: transparent url("assets/achivo-coin.svg?v=9") center / contain no-repeat;
}
.coin::after { display: none; }
.coin-tiny { width: 14px; height: 14px; }
.coin-small { width: 23px; height: 23px; }
.coin-medium { width: 48px; height: 48px; }

.view { display: none; animation: view-in .28s ease both; }
.view.is-active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

.home-profile-card[role="button"] { cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.home-profile-card[role="button"]:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(20,30,34,.15); }
.home-profile-card[role="button"]:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.profile-layout { display: grid; gap: 18px; max-width: 1040px; }
.profile-identity-card {
  display: grid;
  grid-template-columns: 70px minmax(0,1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  color: #fff;
  border-radius: 20px;
  background: linear-gradient(135deg, #242b2f, #15191b);
  box-shadow: 0 14px 34px rgba(19,24,27,.16);
}
.profile-avatar-large { position: relative; display: grid; place-items: center; width: 68px; height: 68px; padding: 0; overflow: hidden; border: 0; border-radius: 20px; color: var(--charcoal); background: var(--orange); box-shadow: 0 0 0 4px rgba(0,191,227,.25); font-size: 28px; font-weight: 900; cursor: pointer; }
.profile-avatar-large:focus-visible,
.profile-avatar-setting-preview:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }
.profile-avatar-large img,
.profile-avatar-setting-preview img,
.avatar img,
.home-avatar img,
.drawer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-identity-copy { min-width: 0; }
.profile-identity-copy h2 { margin: 0 0 6px; overflow: hidden; font-size: 24px; text-overflow: ellipsis; white-space: nowrap; }
.profile-identity-copy p { margin: 0; overflow: hidden; color: #aeb7bb; font-size: 13px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.profile-edit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  color: #fff;
  background: rgba(255,255,255,.08);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: .16s ease;
}
.profile-edit-button:hover { border-color: var(--cyan); background: rgba(0,191,227,.12); }
.profile-edit-button:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.profile-edit-button svg { width: 15px; height: 15px; fill: currentColor; }
.profile-stats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.profile-stat {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0,1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  min-width: 0;
  min-height: 72px;
  padding: 12px 14px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: help;
  transition: background .15s ease;
}
.profile-stat:first-child { border-radius: 16px 0 0 16px; }
.profile-stat:last-child { border-right: 0; border-radius: 0 16px 16px 0; }
.profile-stat:hover,
.profile-stat:focus-visible,
.profile-stat.is-tooltip-open { z-index: 4; background: color-mix(in srgb, var(--cyan) 7%, var(--surface)); }
.profile-stat:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.profile-stat::before,
.profile-stat::after {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease, transform .15s ease;
}
.profile-stat::before {
  left: 50%;
  bottom: calc(100% + 5px);
  width: 9px;
  height: 9px;
  background: #20272b;
  content: "";
  transform: translate(-50%, 3px) rotate(45deg);
}
.profile-stat::after {
  left: 50%;
  bottom: calc(100% + 9px);
  width: max-content;
  max-width: 230px;
  padding: 8px 10px;
  border-radius: 9px;
  color: #fff;
  background: #20272b;
  box-shadow: 0 9px 24px rgba(0,0,0,.2);
  content: attr(data-stat-tooltip);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  transform: translate(-50%, 4px);
}
.profile-stat:hover::before,
.profile-stat:hover::after,
.profile-stat:focus-visible::before,
.profile-stat:focus-visible::after,
.profile-stat.is-tooltip-open::before,
.profile-stat.is-tooltip-open::after { opacity: 1; }
.profile-stat:hover::before,
.profile-stat:focus-visible::before,
.profile-stat.is-tooltip-open::before { transform: translate(-50%, 0) rotate(45deg); }
.profile-stat:hover::after,
.profile-stat:focus-visible::after,
.profile-stat.is-tooltip-open::after { transform: translate(-50%, 0); }
.profile-stat-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
}
.profile-stat-icon svg { width: 18px; height: 18px; fill: currentColor; }
.profile-stat-streak .profile-stat-icon { color: #d16b28; background: #fff0e6; }
.profile-stat-actions .profile-stat-icon { color: #078b67; background: #e5f8f1; }
.profile-stat-rewards .profile-stat-icon { color: #8d3794; background: #f8eafa; }
.profile-stat-team .profile-stat-icon { color: #2772b9; background: #e9f3ff; }
.profile-stat-team { cursor: pointer; }
.profile-stat-rewards .profile-stat-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.profile-stat-team .profile-stat-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.profile-stats strong { align-self: end; font-size: 21px; line-height: 1; }
.profile-stats small {
  align-self: start;
  min-width: 0;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.2;
}
.profile-settings-card { padding: 24px; border-radius: 20px; }
.profile-settings-card[hidden] { display: none; }
.profile-editor-close { flex: 0 0 auto; border-radius: 10px; }
.profile-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.profile-avatar-setting { grid-column: 1 / -1; display: grid; grid-template-columns: 68px minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--cyan) 5%, var(--surface)); }
.profile-avatar-setting-preview { display: grid; place-items: center; width: 64px; height: 64px; padding: 0; overflow: hidden; border: 2px solid var(--charcoal); border-radius: 18px; color: var(--charcoal); background: var(--orange); box-shadow: 3px 3px 0 var(--cyan); font-size: 25px; font-weight: 900; cursor: pointer; }
.profile-avatar-setting-copy strong,
.profile-avatar-setting-copy span { display: block; }
.profile-avatar-setting-copy strong { font-size: 13px; }
.profile-avatar-setting-copy span { margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.profile-avatar-setting-actions { display: flex; align-items: center; gap: 13px; }
.profile-avatar-setting-actions .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding-inline: 14px; color: var(--ink); font-size: 11px; cursor: pointer; }
.profile-avatar-remove { color: var(--danger); }
.profile-avatar-remove:hover { color: #b93324; }
.profile-form label { display: grid; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 800; }
.profile-form input { min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface); font: inherit; outline: none; }
.profile-form input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,191,227,.14); }
.profile-form label > small { margin-top: -3px; color: var(--muted); font-size: 9px; font-weight: 650; }
.profile-username-input {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr);
  min-height: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.profile-username-input:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,191,227,.14); }
.profile-username-input.is-valid { border-color: #26a777; }
.profile-username-input.is-invalid { border-color: #d6695c; }
.profile-username-input b { display: grid; place-items: center; color: var(--cyan-dark); background: color-mix(in srgb, var(--cyan) 9%, var(--surface)); font-size: 16px; }
.profile-username-input input { min-height: 46px; border: 0; border-radius: 0; box-shadow: none !important; }
.profile-username-status.is-available { color: #16805c; }
.profile-username-status.is-unavailable { color: #bd5045; }
.profile-form-actions { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 4px; }
.profile-form-actions > span { color: var(--muted); font-size: 10px; }
.profile-form-actions > div { display: flex; gap: 9px; }
.profile-form-actions .secondary-button,
.profile-form-actions .primary-button { min-height: 42px; padding-inline: 16px; }
.profile-account-card { overflow: hidden; border-radius: 20px; }
.profile-account-heading { padding: 20px 22px 16px; }
.profile-account-heading h2 { margin: 4px 0 0; font-size: 20px; }
.profile-account-heading p { max-width: 590px; margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.profile-account-actions { border-top: 1px solid var(--line); }
.profile-account-actions > button {
  display: grid;
  grid-template-columns: 40px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 62px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.profile-account-actions > button:last-child { border-bottom: 0; }
.profile-account-actions > button:hover { background: color-mix(in srgb, var(--cyan) 5%, var(--surface)); }
.profile-account-actions > button > span:nth-child(2) { min-width: 0; }
.profile-account-actions strong,
.profile-account-actions small { display: block; }
.profile-account-actions strong { font-size: 13px; }
.profile-account-actions small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.3; }
.profile-account-actions > button > b { color: var(--muted); font-size: 24px; font-weight: 400; }
.profile-account-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: var(--cyan-dark); background: var(--cyan-pale); font-size: 20px; font-weight: 800; }
.profile-account-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.profile-account-actions .is-danger strong { color: #b83232; }
.profile-account-actions .is-danger .profile-account-icon { color: #b83232; background: #fff0f0; }

.profile-rhythm-card {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.profile-rhythm-main { padding: 22px; color: #fff; background: linear-gradient(145deg, #17323a, #10191e); }
.profile-rhythm-heading { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.profile-rhythm-heading h2 { margin: 4px 0 0; font-size: 21px; }
.profile-rhythm-heading .section-kicker { color: #70dff0; }
.profile-rhythm-flame { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: rgba(252,170,7,.16); font-size: 23px; }
.profile-rhythm-numbers { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-top: 24px; }
.profile-rhythm-numbers strong { font-size: 18px; }
.profile-rhythm-numbers strong b { color: var(--orange); font-size: 34px; }
.profile-rhythm-numbers > span { padding-bottom: 4px; color: #aebdc3; font-size: 10px; }
.profile-rhythm-progress { height: 9px; margin-top: 12px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.12); }
.profile-rhythm-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), var(--cyan)); transition: width .25s ease; }
.profile-rhythm-main p { margin: 10px 0 0; color: #aebdc3; font-size: 10px; }
.profile-rhythm-main p b { color: #fff; }
.profile-achievements { padding: 22px; }
.profile-achievements-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.profile-achievements-heading > strong { font-size: 17px; }
.profile-achievements-heading > span { color: var(--muted); font-size: 9px; }
.profile-achievement-list { display: grid; gap: 8px; margin-top: 15px; }
.profile-achievement-list article { display: grid; grid-template-columns: 38px minmax(0,1fr) 24px; gap: 10px; align-items: center; min-height: 50px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 13px; opacity: .48; }
.profile-achievement-list article > span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--canvas); filter: grayscale(1); }
.profile-achievement-list article strong, .profile-achievement-list article small { display: block; }
.profile-achievement-list article strong { font-size: 11px; }
.profile-achievement-list article small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.profile-achievement-list article > b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: transparent; border: 1px solid var(--line); font-size: 11px; }
.profile-achievement-list article.is-earned { opacity: 1; background: color-mix(in srgb, var(--cyan) 4%, var(--surface)); }
.profile-achievement-list article.is-earned > span { background: color-mix(in srgb, var(--cyan) 10%, var(--surface)); filter: none; }
.profile-achievement-list article.is-earned > b { color: #fff; border-color: var(--green); background: var(--green); }

.team-page {
  display: grid;
  gap: 18px;
  max-width: 1040px;
}
.team-invite-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 18px 28px;
  overflow: hidden;
  padding: 28px;
  border-radius: 22px;
  color: var(--ink);
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 90% 15%, rgba(0,191,227,.12), transparent 34%),
    var(--surface);
  box-shadow: var(--shadow);
}
.team-invite-copy { position: relative; z-index: 1; }
.team-invite-copy .section-kicker { color: var(--cyan-dark); }
.team-invite-copy h2 { margin: 5px 0 10px; font-size: 30px; letter-spacing: -.035em; }
.team-invite-copy p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.team-invite-visual {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 82px;
}
.team-invite-visual span {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-left: -13px;
  border: 3px solid #1b2124;
  border-radius: 18px;
  color: #202629;
  background: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,255,255,.08);
  font-size: 19px;
  font-weight: 900;
}
.team-invite-visual span:first-child { margin-left: 0; background: var(--cyan); transform: rotate(-6deg); }
.team-invite-visual span:last-child { background: #fff; transform: rotate(6deg); }
.team-invite-fields {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(250px, 1.6fr) minmax(190px, .8fr) auto;
  gap: 10px;
  align-items: end;
}
.team-invite-field { min-width: 0; }
.team-invite-field > span {
  display: block;
  margin: 0 0 7px 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.team-invite-field > div {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  min-height: 45px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--canvas);
}
.team-invite-field code {
  align-self: center;
  overflow: hidden;
  padding: 0 13px;
  color: var(--ink);
  font: 750 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-invite-field button {
  padding: 0 13px;
  border: 0;
  border-left: 1px solid var(--line);
  color: var(--cyan-dark);
  background: color-mix(in srgb, var(--cyan) 8%, var(--surface));
  font-size: 9px;
  font-weight: 850;
  cursor: pointer;
}
.team-invite-field button:hover { color: var(--ink); background: color-mix(in srgb, var(--cyan) 18%, var(--surface)); }
.team-share-button {
  min-height: 45px;
  border: 0;
  border-radius: 12px;
  box-shadow: none;
}
.team-invite-note {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  margin: -5px 2px 0;
  color: var(--muted);
  font-size: 9px;
}
.team-members-card {
  overflow: hidden;
  border-radius: 20px;
}
.team-members-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}
.team-members-heading h2 { margin: 4px 0 0; font-size: 22px; }
.team-members-heading p { margin: 7px 0 0; color: var(--muted); font-size: 10px; }
.team-members-heading-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.team-members-heading-actions > strong {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 11px;
  color: #2772b9;
  background: #e9f3ff;
  font-size: 10px;
}
.team-members-heading-actions > strong b { font-size: 16px; }
.team-nudge-all-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  color: #172226;
  background: var(--orange);
  font-size: 10px;
  font-weight: 850;
  cursor: pointer;
}
.team-nudge-all-button b {
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  color: #fff;
  background: #202629;
  font-size: 9px;
}
.team-nudge-all-button:disabled { color: var(--muted); background: var(--line); cursor: not-allowed; }
.team-member-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 22px 9px;
}
.team-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(390px, 100%);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 94%, var(--canvas));
}
.team-search > span { color: var(--muted); font-size: 19px; }
.team-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 11px;
}
.team-member-tools > span { color: var(--muted); font-size: 9px; white-space: nowrap; }
.team-nudge-note {
  margin: 0;
  padding: 0 22px 10px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}
.team-member-list { padding: 0 18px; }
.team-member {
  display: grid;
  grid-template-columns: 38px minmax(150px,1fr) minmax(126px,.7fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 8px 5px;
  border-bottom: 1px solid var(--line);
}
.team-member:last-child { border-bottom: 0; }
.team-member-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: #202629;
  background: var(--cyan);
  font-size: 14px;
  font-weight: 900;
}
.team-member:nth-child(2n) .team-member-avatar { background: var(--orange); }
.team-member:nth-child(3n) .team-member-avatar { background: #d9c3f0; }
.team-member-copy { min-width: 0; }
.team-member-copy strong,
.team-member-copy span,
.team-member-activity span,
.team-member-activity strong { display: block; }
.team-member-copy strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.team-member-copy span { margin-top: 3px; color: var(--cyan-dark); font-size: 9px; font-weight: 750; }
.team-member-actions {
  display: grid;
  grid-template-columns: 88px 94px;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 189px;
}
.team-member-chivs {
  display: inline-flex;
  grid-column: 2;
  gap: 4px;
  align-items: center;
  justify-content: center;
  width: 94px;
  min-width: 94px;
  padding: 5px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--orange) 24%, var(--surface));
}
.team-member-chivs .coin { width: 15px; height: 15px; }
.team-member-chivs strong { font-size: 11px; }
.team-member-chivs small { color: var(--muted); font-size: 7px; }
.team-member-activity span { color: var(--muted); font-size: 7px; }
.team-member-activity strong { margin-top: 3px; font-size: 9px; }
.team-member-activity strong.is-away { color: #c06422; }
.team-nudge-button {
  display: inline-flex;
  grid-column: 1;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 88px;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 92%, var(--canvas));
  font-size: 8px;
  font-weight: 800;
}
.team-nudge-button.is-ready {
  border-color: #f0bf57;
  color: #694400;
  background: #fff3d8;
  cursor: pointer;
}
.team-nudge-button.is-ready:hover { transform: translateY(-1px); background: var(--orange); }
.team-nudge-button:disabled { cursor: not-allowed; opacity: .76; }
.team-nudge-status {
  display: inline-flex;
  grid-column: 1;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 88px;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 88%, var(--canvas));
  font-size: 7px;
  font-weight: 800;
  white-space: nowrap;
}
.team-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 15px 18px 18px;
  border-top: 1px solid var(--line);
}
.team-pagination button {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.team-pagination button.is-active { color: #172226; border-color: var(--cyan); background: var(--cyan); }
.team-pagination button:disabled { opacity: .35; cursor: not-allowed; }
.team-empty {
  display: grid;
  justify-items: center;
  min-height: 250px;
  align-content: center;
  padding: 28px;
  text-align: center;
}
.team-empty > span { margin-bottom: 12px; color: var(--cyan-dark); font-size: 38px; }
.team-empty strong { font-size: 17px; }
.team-empty p { max-width: 390px; margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

:root[data-theme="dark"] .team-members-card { color: var(--ink); border-color: var(--line); background: var(--surface); }
:root[data-theme="dark"] .team-members-heading-actions > strong { color: #91c5f5; background: #1b3045; }
:root[data-theme="dark"] .team-nudge-button.is-ready { color: #ffd981; background: #4a3510; border-color: #7e5a14; }

@media (max-width: 820px) {
  .team-page { gap: 13px; }
  .team-invite-card { grid-template-columns: minmax(0,1fr) 128px; gap: 15px; padding: 20px; border-radius: 18px; }
  .team-invite-copy h2 { font-size: 25px; }
  .team-invite-copy p { font-size: 11px; }
  .team-invite-visual span { width: 48px; height: 48px; border-radius: 15px; }
  .team-invite-fields { grid-template-columns: 1fr 1fr; }
  .team-share-button { grid-column: 1 / -1; }
  .team-member {
    grid-template-columns: 36px minmax(120px, 1fr) minmax(110px, .6fr) auto;
  }
}

/* Achivo v0.18.0: FAQ, blog materials and feedback. */
.help-page {
  display: grid;
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
}
.help-hero {
  display: grid;
  justify-items: center;
  padding: 34px 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 15% 15%, rgba(0,191,227,.13), transparent 32%),
    radial-gradient(circle at 88% 12%, rgba(252,170,7,.12), transparent 30%),
    var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.help-hero-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 18px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(145deg, #245fec, #8f2deb);
  box-shadow: 0 9px 24px rgba(72,72,222,.22);
  font-size: 32px;
  font-weight: 900;
}
.help-hero h2 { margin: 1px 0 8px; font-size: clamp(25px,3vw,34px); letter-spacing: -.035em; }
.help-hero p { max-width: 620px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.faq-group {
  --faq-accent: var(--cyan);
  --faq-tint: rgba(0,191,227,.055);
  padding: 20px 22px 8px;
  border: 1px solid color-mix(in srgb, var(--faq-accent) 38%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--faq-tint) 60%, var(--surface));
}
.faq-group.tone-orange { --faq-accent: #e99b00; --faq-tint: rgba(252,170,7,.06); }
.faq-group.tone-purple { --faq-accent: #8f31dd; --faq-tint: rgba(143,49,221,.055); }
.faq-group.tone-green { --faq-accent: #09a57d; --faq-tint: rgba(9,165,125,.055); }
.faq-group.tone-cyan { --faq-accent: #008fb1; --faq-tint: rgba(0,191,227,.055); }
.faq-group.tone-yellow { --faq-accent: #d49100; --faq-tint: rgba(252,193,48,.065); }
.faq-group h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 9px;
  font-size: 17px;
}
.faq-group h3 span { color: var(--faq-accent); font-size: 20px; }
.faq-group details { border-top: 1px solid color-mix(in srgb, var(--faq-accent) 31%, var(--line)); }
.faq-group details:first-of-type { border-top: 0; }
.faq-group summary {
  display: grid;
  grid-template-columns: minmax(0,1fr) 24px;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 8px 1px;
  list-style: none;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}
.faq-group summary::-webkit-details-marker { display: none; }
.faq-group summary > span { color: var(--muted); font-size: 18px; text-align: center; transition: transform .18s ease; }
.faq-group details[open] summary > span { color: var(--faq-accent); transform: rotate(180deg); }
.faq-group details p { max-width: 760px; margin: -1px 34px 16px 1px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.help-contact-card {
  display: grid;
  grid-template-columns: 52px minmax(0,1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.help-contact-card > span {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: var(--cyan-pale);
  font-size: 24px;
}
.help-contact-card h3 { margin: 0 0 5px; font-size: 18px; }
.help-contact-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.help-contact-card button { min-width: 128px; }
.help-materials {
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.help-materials h3 { margin: 0; font-size: 20px; }
.help-material-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 17px; }
.help-material-link {
  display: grid;
  grid-template-columns: 36px minmax(0,1fr);
  grid-template-rows: auto auto;
  column-gap: 11px;
  align-items: center;
  min-height: 66px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--canvas);
  text-decoration: none;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.help-material-link:not(.is-disabled):hover { border-color: var(--cyan); background: var(--cyan-pale); transform: translateY(-1px); }
.help-material-link.is-disabled { cursor: default; }
.help-material-link.is-disabled > span { color: var(--muted); }
.help-material-link > span { grid-row: 1 / 3; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface); font-size: 17px; }
.help-material-grid strong { font-size: 12px; }
.help-material-grid small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.feedback-modal .modal-heading { margin-bottom: 20px; }
.feedback-modal .modal-heading p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.feedback-modal label { position: relative; }
.feedback-modal textarea { width: 100%; min-height: 140px; padding: 13px; line-height: 1.55; resize: vertical; }
.feedback-counter { position: absolute; top: 0; right: 0; color: var(--muted); font-size: 10px; font-weight: 600; }
.feedback-counter b { color: inherit; }
.feedback-counter b.is-near-limit { color: var(--danger); }
.feedback-limit-note { display: flex; gap: 7px; margin: 14px 0 0; color: var(--muted); font-size: 10px; }
:root[data-theme="dark"] .help-hero,
:root[data-theme="dark"] .faq-group,
:root[data-theme="dark"] .help-contact-card,
:root[data-theme="dark"] .help-materials { background-color: var(--surface); }
:root[data-theme="dark"] .help-material-link { background: var(--canvas); }
:root[data-theme="dark"] .help-material-link:not(.is-disabled):hover { background: #123943; }
:root[data-theme="dark"] .help-contact-card > span { background: #12343d; }

@media (max-width: 660px) {
  .help-page { gap: 12px; }
  .help-hero { padding: 27px 18px; }
  .faq-group { padding: 17px 16px 6px; }
  .faq-group summary { min-height: 58px; font-size: 12px; line-height: 1.4; }
  .faq-group details p { margin-right: 24px; font-size: 11px; }
  .help-contact-card { grid-template-columns: 45px minmax(0,1fr); padding: 18px 16px; }
  .help-contact-card > span { width: 45px; height: 45px; }
  .help-contact-card button { grid-column: 1 / -1; width: 100%; }
  .help-materials { padding: 19px 16px; }
  .help-material-grid { grid-template-columns: 1fr; }
}

/* Achivo v0.18.0: achievements and a genuinely light profile theme. */
.profile-identity-card {
  color: var(--ink);
  border: 1px solid #cdebf0;
  background:
    radial-gradient(circle at 88% 12%, rgba(0,191,227,.14), transparent 34%),
    linear-gradient(145deg, #effbfd 0%, #ffffff 72%);
  box-shadow: 0 14px 34px rgba(45,49,52,.09);
}
.profile-identity-copy p { color: var(--muted); }
.profile-edit-button { color: var(--ink); border-color: var(--line); background: rgba(255,255,255,.86); }
.profile-edit-button:hover { color: #087f96; border-color: var(--cyan); background: var(--cyan-pale); }
.profile-rhythm-main {
  color: var(--ink);
  border-right: 1px solid var(--line);
  background:
    radial-gradient(circle at 92% 10%, rgba(252,170,7,.13), transparent 30%),
    linear-gradient(145deg, #eefafd, #ffffff);
}
.profile-rhythm-heading .section-kicker { color: var(--cyan-dark); }
.profile-rhythm-flame { background: #fff2d3; }
.profile-rhythm-numbers > span,
.profile-rhythm-main p { color: var(--muted); }
.profile-rhythm-main p b { color: var(--ink); }
.profile-rhythm-progress { background: #dcebed; }
.profile-achievements-heading { align-items: center; }
.profile-achievements-heading > div { min-width: 0; }
.profile-achievements-heading > div > strong,
.profile-achievements-heading > div > span { display: block; }
.profile-achievements-heading > div > strong { font-size: 17px; }
.profile-achievements-heading > div > span { margin-top: 4px; color: var(--muted); font-size: 9px; }
.profile-achievements-heading .text-button { flex: 0 0 auto; font-size: 9px; }
.profile-achievement-list article.is-empty { opacity: .5; }
.profile-achievement-list article.is-empty > span { color: var(--muted); filter: none; }

.achievements-page { display: grid; gap: 18px; max-width: 1040px; }
.achievements-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 27px 30px 32px;
  overflow: hidden;
  border: 1px solid #bfe8f0;
  border-radius: 22px;
  background:
    radial-gradient(circle at 90% 12%, rgba(252,170,7,.2), transparent 27%),
    linear-gradient(145deg, #ecfafd, #ffffff 70%);
  box-shadow: var(--shadow);
}
.achievements-hero-copy h2 { margin: 4px 0 8px; font-size: clamp(24px,3vw,34px); letter-spacing: -.035em; }
.achievements-hero-copy p { max-width: 650px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.achievements-score { display: grid; grid-template-columns: 48px auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; min-width: 170px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.8); }
.achievements-score > span { grid-row: 1 / 3; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: #fff1cf; font-size: 25px; }
.achievements-score strong { font-size: 18px; }
.achievements-score small { color: var(--muted); font-size: 9px; }
.achievements-overall-progress { position: absolute; right: 30px; bottom: 16px; left: 30px; height: 7px; overflow: hidden; border-radius: 99px; background: #dbeaec; }
.achievements-overall-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--orange),var(--cyan)); transition: width .3s ease; }

.achievement-category-tabs { display: grid; grid-template-columns: repeat(8,minmax(0,1fr)); gap: 8px; }
.achievement-category-tabs button { display: grid; grid-template-columns: 27px minmax(0,1fr); grid-template-rows: auto auto; column-gap: 7px; align-items: center; min-width: 0; min-height: 52px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--surface); text-align: left; cursor: pointer; }
.achievement-category-tabs button > span { grid-row: 1 / 3; display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: var(--canvas); font-size: 14px; }
.achievement-category-tabs button b { overflow: hidden; font-size: 8px; text-overflow: ellipsis; }
.achievement-category-tabs button small { color: var(--muted); font-size: 7px; }
.achievement-category-tabs button.is-active { color: #112025; border-color: var(--cyan); background: var(--cyan-pale); box-shadow: 0 0 0 3px rgba(0,191,227,.09); }
.achievement-category-tabs button.is-active > span { background: #fff; }

.achievement-catalog { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.achievement-card { display: grid; grid-template-columns: 50px minmax(0,1fr) 28px; gap: 13px; align-items: start; min-height: 138px; padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 8px 24px rgba(45,49,52,.055); opacity: .78; }
.achievement-card-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 15px; color: var(--muted); background: var(--canvas); font-size: 24px; filter: grayscale(1); }
.achievement-card-main { min-width: 0; }
.achievement-card-heading { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.achievement-card-heading strong { font-size: 13px; }
.achievement-card-heading span { flex: 0 0 auto; color: var(--muted); font-size: 7px; }
.achievement-card p { min-height: 30px; margin: 7px 0 11px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.achievement-progress { height: 6px; overflow: hidden; border-radius: 99px; background: var(--canvas); }
.achievement-progress i { display: block; height: 100%; border-radius: inherit; background: #aebbc0; transition: width .25s ease; }
.achievement-card-main > small { display: block; margin-top: 6px; color: var(--muted); font-size: 7px; text-align: right; }
.achievement-state { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; color: transparent; font-size: 13px; }
.achievement-card.is-earned { opacity: 1; border-color: #b9e8ef; background: color-mix(in srgb,var(--cyan) 4%,var(--surface)); }
.achievement-card.is-earned .achievement-card-icon { color: inherit; background: color-mix(in srgb,var(--cyan) 11%,var(--surface)); filter: none; }
.achievement-card.is-earned .achievement-progress i { background: linear-gradient(90deg,var(--orange),var(--cyan)); }
.achievement-card.is-earned .achievement-state { color: #fff; border-color: var(--green); background: var(--green); }
.achievement-card.is-secret:not(.is-earned) .achievement-card-icon { color: #8c969b; background: #eef1f2; font-weight: 900; }

.achievement-win-modal { width: min(440px,calc(100vw - 28px)); padding: 0; overflow: visible; border: 0; border-radius: 24px; color: var(--ink); background: transparent; }
.achievement-win-modal::backdrop { background: rgba(8,18,24,.7); backdrop-filter: blur(6px); }
.achievement-win-dialog { position: relative; display: grid; justify-items: center; padding: 34px 28px 28px; overflow: hidden; border: 1px solid #bce8ef; border-radius: 24px; background: radial-gradient(circle at 50% -10%,rgba(0,191,227,.24),transparent 43%),var(--surface); box-shadow: 0 28px 90px rgba(8,18,24,.42); text-align: center; }
.achievement-win-dialog::after { position: absolute; inset: 10px; border: 1px dashed rgba(0,191,227,.25); border-radius: 18px; pointer-events: none; content: ""; }
.achievement-win-kicker { position: relative; z-index: 1; color: var(--cyan-dark); font: 900 9px/1 ui-monospace,monospace; letter-spacing: .13em; }
.achievement-win-icon { position: relative; z-index: 1; display: grid; place-items: center; width: 92px; height: 92px; margin: 22px 0 17px; border: 7px solid #fff1cc; border-radius: 28px; background: linear-gradient(145deg,#fff9e8,#ffd873); box-shadow: 0 12px 30px rgba(252,170,7,.25); font-size: 45px; transform: rotate(-3deg); }
.achievement-win-dialog h2 { position: relative; z-index: 1; margin: 0; font-size: 27px; letter-spacing: -.035em; }
.achievement-win-dialog p { position: relative; z-index: 1; max-width: 320px; margin: 10px 0 22px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.achievement-win-dialog button { position: relative; z-index: 1; min-width: 150px; }

:root[data-theme="dark"] .profile-identity-card {
  color: #fff;
  border-color: #33434b;
  background: linear-gradient(135deg,#242b2f,#15191b);
  box-shadow: 0 14px 34px rgba(0,0,0,.24);
}
:root[data-theme="dark"] .profile-identity-copy p { color: #aeb7bb; }
:root[data-theme="dark"] .profile-edit-button { color: #fff; border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.08); }
:root[data-theme="dark"] .profile-rhythm-main { color: #fff; border-right-color: var(--line); background: linear-gradient(145deg,#17323a,#10191e); }
:root[data-theme="dark"] .profile-rhythm-heading .section-kicker { color: #70dff0; }
:root[data-theme="dark"] .profile-rhythm-flame { background: rgba(252,170,7,.16); }
:root[data-theme="dark"] .profile-rhythm-numbers > span,
:root[data-theme="dark"] .profile-rhythm-main p { color: #aebdc3; }
:root[data-theme="dark"] .profile-rhythm-main p b { color: #fff; }
:root[data-theme="dark"] .profile-rhythm-progress { background: rgba(255,255,255,.12); }
:root[data-theme="dark"] .achievements-hero { border-color: #2d535c; background: radial-gradient(circle at 90% 12%,rgba(252,170,7,.12),transparent 27%),linear-gradient(145deg,#182a31,#182129 70%); }
:root[data-theme="dark"] .achievements-score { background: rgba(8,14,18,.38); }
:root[data-theme="dark"] .achievement-category-tabs button.is-active { color: #dff8fc; background: #123943; }
:root[data-theme="dark"] .achievement-category-tabs button.is-active > span { background: #1b2d35; }
:root[data-theme="dark"] .achievement-card.is-secret:not(.is-earned) .achievement-card-icon { color: #8c969b; background: #222e35; }

@media (max-width: 980px) {
  .achievement-category-tabs { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .profile-rhythm-main { border-right: 0; border-bottom: 1px solid var(--line); }
  .achievement-catalog { grid-template-columns: 1fr; }
  .achievements-hero { grid-template-columns: 1fr; padding: 22px 18px 32px; }
  .achievements-score { width: fit-content; }
  .achievements-overall-progress { right: 18px; left: 18px; }
}
@media (max-width: 520px) {
  .profile-achievements-heading { align-items: flex-start; }
  .profile-achievements-heading > div > span { max-width: 180px; line-height: 1.35; }
  .achievement-category-tabs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; margin-inline: 0; padding: 0; overflow: visible; }
  .achievement-category-tabs button { min-height: 50px; padding: 7px 8px; }
  .achievement-category-tabs button b { font-size: 8.5px; }
  .achievement-card { grid-template-columns: 44px minmax(0,1fr) 26px; gap: 10px; min-height: 132px; padding: 14px 12px; }
  .achievement-card-icon { width: 44px; height: 44px; border-radius: 13px; font-size: 21px; }
  .achievement-card-heading { display: grid; gap: 3px; }
  .achievement-card-heading span { font-size: 6.5px; }
  .achievement-win-dialog { padding-inline: 20px; }
}

/* Achivo v0.17.0: classic actions, multi-actions and simplified daily completion. */

.cloud-sync-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(14, 27, 31, .72);
  backdrop-filter: blur(10px);
}
.cloud-sync-gate[hidden] { display: none; }
.cloud-sync-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 2px solid var(--cyan);
  border-radius: 24px;
  color: var(--ink);
  text-align: center;
  background: var(--surface);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .28);
}
.cloud-sync-card > span { display: block; margin-bottom: 12px; font-size: 42px; }
.cloud-sync-card strong { display: block; font-size: 22px; }
.cloud-sync-card p { margin: 12px 0 22px; color: var(--muted); line-height: 1.55; }
.cloud-sync-card button {
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  color: #092c34;
  font-weight: 800;
  background: var(--cyan);
  cursor: pointer;
}
html {
  min-height: 100%;
  color-scheme: light;
  background: var(--canvas);
}
body,
.app-shell,
.main-area {
  width: 100%;
  max-width: none;
  background-color: var(--canvas);
}
body { min-height: 100vh; overflow-x: hidden; }
:root[data-theme="dark"] { color-scheme: dark; }

.account-drawer:not(.is-open),
.notification-center:not(.is-open) {
  box-shadow: none;
  pointer-events: none;
}
.account-drawer.is-open { box-shadow: -22px 0 50px rgba(0,0,0,.35); }
.notification-center.is-open { box-shadow: -22px 0 60px rgba(8,18,24,.24); }

#habitsView .actions-toolbar,
#habitsView .editor-tools {
  gap: 8px;
}
#habitsView .actions-toolbar > button,
#habitsView .editor-tools > button {
  min-width: 0;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.15;
  white-space: nowrap;
}
#habitsView .editor-tools {
  margin: -8px 0 20px;
  padding: 10px;
  border-radius: 18px;
  background: var(--surface);
}
#habitsView .editor-tools .primary-button {
  color: #071013;
  background: var(--orange);
  box-shadow: 0 9px 20px rgba(252,170,7,.2);
}
#habitsView .editor-tools .secondary-button,
#habitsView .actions-toolbar .secondary-button {
  color: var(--ink);
  background: var(--surface);
}

@media (max-width: 720px) {
  #habitsView .actions-toolbar,
  #habitsView .editor-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  #habitsView .editor-tools > button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  #habitsView .actions-toolbar > button,
  #habitsView .editor-tools > button { font-size: 11px; }
}

@media (max-width: 380px) {
  #habitsView .actions-toolbar > button,
  #habitsView .editor-tools > button {
    gap: 5px;
    padding-inline: 6px;
    font-size: 9px;
  }
}

/* Achivo v0.13.0: calmer navigation, day cards, and theme-safe social/profile blocks. */
:root[data-theme="dark"] .team-invite-card {
  color: #fff;
  border-color: var(--line);
  background:
    radial-gradient(circle at 90% 15%, rgba(0,191,227,.28), transparent 34%),
    linear-gradient(135deg, #252c30, #121719);
  box-shadow: 0 16px 38px rgba(0,0,0,.2);
}
:root[data-theme="dark"] .team-invite-copy .section-kicker { color: #69d9eb; }
:root[data-theme="dark"] .team-invite-copy p { color: #b8c1c5; }
:root[data-theme="dark"] .team-invite-field > span { color: #9ca8ad; }
:root[data-theme="dark"] .team-invite-field > div { border-color: rgba(255,255,255,.15); background: rgba(255,255,255,.07); }
:root[data-theme="dark"] .team-invite-field code { color: #fff; }
:root[data-theme="dark"] .team-invite-field button { border-left-color: rgba(255,255,255,.13); color: #79dced; background: rgba(0,191,227,.08); }
:root[data-theme="dark"] .team-invite-field button:hover { color: #fff; background: rgba(0,191,227,.18); }
:root[data-theme="dark"] .team-invite-note { color: #818e94; }

.history-feed.panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.history-day-group {
  overflow: hidden;
  margin-bottom: 12px;
  padding: 6px 16px 3px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(32,44,50,.05);
}
.history-day-group + .history-day-group { border-top: 1px solid var(--line); }
.history-day-heading { border-bottom: 1px solid var(--line); }

@media (max-width: 820px) {
  .sidebar,
  .app-shell.is-sidebar-collapsed .sidebar {
    color: #8b969c;
    background: rgba(255,255,255,.96);
  }
  .nav-item,
  .app-shell.is-sidebar-collapsed .nav-item {
    border: 2px solid transparent;
    color: #8b969c;
    background: transparent;
  }
  .nav-item:hover { color: #66737a; background: rgba(0,191,227,.04); }
  .nav-item.is-active {
    color: #087f96;
    border-color: var(--cyan);
    background: rgba(0,191,227,.055);
    box-shadow: none;
  }
  :root[data-theme="dark"] .sidebar,
  :root[data-theme="dark"] .app-shell.is-sidebar-collapsed .sidebar {
    color: #a7b2b8;
    border-top-color: #2c3a42;
    background: rgba(15,24,29,.97);
  }
  :root[data-theme="dark"] .nav-item,
  :root[data-theme="dark"] .app-shell.is-sidebar-collapsed .nav-item { color: #a7b2b8; background: transparent; }
  :root[data-theme="dark"] .nav-item:hover { color: #d7e0e4; background: rgba(255,255,255,.035); }
  :root[data-theme="dark"] .nav-item.is-active {
    color: #6ce0f2;
    border-color: var(--cyan);
    background: rgba(0,191,227,.07);
    box-shadow: none;
  }
  .profile-rhythm-card { grid-template-columns: 1fr; }
  .profile-rhythm-main, .profile-achievements { padding: 18px 15px; }
  .profile-rhythm-heading h2 { font-size: 19px; }
  .profile-rhythm-numbers { margin-top: 17px; }
  .history-day-group { padding-inline: 11px; border-radius: 15px; }
}

@media (max-width: 540px) {
  .team-invite-card { grid-template-columns: 1fr; padding: 18px 15px; }
  .team-invite-copy h2 { font-size: 23px; }
  .team-invite-visual { display: none; }
  .team-invite-fields { grid-template-columns: 1fr; }
  .team-code-field { grid-column: auto; }
  .team-share-button { grid-column: auto; width: 100%; }
  .team-members-heading { display: grid; align-items: flex-start; padding: 17px 15px 14px; }
  .team-members-heading p { max-width: 220px; line-height: 1.4; }
  .team-members-heading-actions { width: 100%; }
  .team-members-heading-actions > strong span { display: none; }
  .team-nudge-all-button { flex: 1; }
  .team-member-tools { display: grid; gap: 8px; padding: 12px 15px 8px; }
  .team-search { width: 100%; }
  .team-member-tools > span { padding-left: 3px; }
  .team-nudge-note { padding: 0 15px 9px; }
  .team-member-list { padding-inline: 10px; }
  .team-member { grid-template-columns: 34px minmax(0,1fr) auto; gap: 4px 8px; min-height: 58px; padding: 7px 4px; }
  .team-member-avatar { grid-row: 1 / 3; width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }
  .team-member-copy { grid-column: 2; grid-row: 1; align-self: end; }
  .team-member-copy strong,
  .team-member-copy span { display: inline; }
  .team-member-copy span { margin: 0 0 0 5px; }
  .team-member-actions { grid-column: 3; grid-row: 1 / 3; align-self: center; justify-self: end; gap: 5px; }
  .team-member-actions { grid-template-columns: 82px 82px; min-width: 169px; }
  .team-member-chivs { width: 82px; min-width: 82px; padding-inline: 6px; }
  .team-member-chivs small { display: none; }
  .team-member-activity { grid-column: 2; grid-row: 2; align-self: start; }
  .team-member-activity span,
  .team-member-activity strong { display: inline; font-size: 8px; }
  .team-member-activity strong { margin-left: 3px; }
  .team-nudge-button,
  .team-nudge-status { width: 82px; min-height: 27px; }
  .team-nudge-button { padding-inline: 7px; }
}

.hero-card { position: relative; display: grid; grid-template-columns: 1fr 260px; min-height: 230px; padding: 36px 40px; overflow: hidden; color: #071013; background: var(--cyan); border: 3px solid var(--charcoal); box-shadow: 8px 8px 0 var(--charcoal); }
.hero-card::before, .hero-card::after { content: ""; position: absolute; background: rgba(255,255,255,.18); }
.hero-card::before { right: -30px; bottom: -50px; width: 330px; height: 180px; transform: rotate(-11deg); }
.hero-card::after { left: 49%; top: 0; width: 80px; height: 8px; background: var(--orange); box-shadow: 120px 0 0 rgba(255,255,255,.85); }
.pixel-label { display: inline-block; margin-bottom: 14px; padding: 7px 10px; color: #fff; background: var(--charcoal); font: 900 10px/1 ui-monospace, monospace; letter-spacing: .12em; box-shadow: 3px 3px 0 rgba(0,0,0,.2); }
.hero-copy { position: relative; z-index: 1; max-width: 650px; }
.hero-copy h2 { margin: 0; max-width: 650px; font-size: clamp(30px, 4vw, 54px); line-height: .98; letter-spacing: -.055em; }
.hero-copy p { max-width: 600px; margin: 18px 0 22px; font-size: 16px; line-height: 1.45; }
.hero-progress-row { display: flex; align-items: center; gap: 14px; }
.hero-progress { width: min(360px, 70%); height: 12px; padding: 3px; background: rgba(45,49,52,.25); }
.hero-progress i { display: block; width: 0; height: 100%; background: var(--charcoal); transition: width .45s ease; }
.hero-progress-row strong { font-family: ui-monospace, monospace; font-size: 12px; }
.hero-coin-stack { position: relative; z-index: 1; min-height: 160px; }
.coin-hero { position: absolute; top: 14px; right: 40px; width: 132px; height: 132px; filter: drop-shadow(12px 12px 0 var(--charcoal)); transform: rotate(8deg); }
.coin-back { position: absolute; top: 88px; right: 150px; width: 64px; height: 64px; opacity: .82; filter: drop-shadow(6px 6px 0 rgba(45,49,52,.7)); transform: rotate(-12deg); }
.pixel-spark { position: absolute; width: 10px; height: 10px; background: #fff; box-shadow: 10px 0 0 #fff, 0 10px 0 #fff, 10px 10px 0 #fff; }
.spark-one { top: 16px; right: 196px; }
.spark-two { right: 4px; bottom: 12px; transform: scale(.7); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, .8fr); gap: 22px; margin-top: 30px; }
.panel { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.habits-today-panel { padding: 26px; }
.panel-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 20px; }
.panel-heading.compact { align-items: start; margin-bottom: 18px; }
.panel-heading h2, .section-toolbar h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.text-button { padding: 0; border: 0; color: var(--cyan-dark); background: none; font-size: 12px; font-weight: 800; cursor: pointer; }
.text-button:hover { color: var(--charcoal); }
.habit-list { display: grid; gap: 10px; }
.habit-row { display: grid; grid-template-columns: 48px 1fr auto auto; gap: 13px; align-items: center; min-height: 69px; padding: 10px 12px; border: 1px solid var(--line); background: #fff; transition: .18s ease; }
.habit-row:hover { transform: translateX(3px); border-color: #b8dfe7; }
.habit-row.is-done { background: #f7fbfa; }
.habit-row.is-done .habit-main strong { text-decoration: line-through; color: #7d8589; }
.habit-icon { display: grid; place-items: center; width: 46px; height: 46px; color: var(--charcoal); background: var(--cyan-pale); border: 2px solid var(--charcoal); box-shadow: 3px 3px 0 var(--cyan); }
.habit-icon svg { width: 25px; height: 25px; fill: currentColor; shape-rendering: crispEdges; }
.habit-main strong, .habit-main span { display: block; }
.habit-main strong { font-size: 14px; }
.habit-main span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.point-badge { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; color: #6b4300; background: #fff6dc; border: 1px solid #f7db92; font: 900 11px/1 ui-monospace, monospace; }
.complete-button { display: grid; place-items: center; width: 38px; height: 38px; border: 2px solid var(--charcoal); color: transparent; background: #fff; cursor: pointer; box-shadow: 3px 3px 0 var(--charcoal); transition: .1s ease; }
.complete-button svg { width: 20px; height: 20px; fill: currentColor; }
.complete-button:hover { color: var(--charcoal); background: var(--yellow); }
.complete-button:active { transform: translate(3px,3px); box-shadow: none; }
.habit-row.is-done .complete-button { color: var(--charcoal); background: var(--cyan); }

.dashboard-side { display: grid; align-content: start; gap: 22px; }
.week-panel, .reward-preview-panel { padding: 23px; }
.streak-number { display: grid; place-items: center; width: 42px; height: 42px; color: var(--charcoal); background: var(--orange); border: 2px solid var(--charcoal); box-shadow: 3px 3px 0 var(--charcoal); font: 900 20px/1 ui-monospace, monospace; }
.week-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.week-day { text-align: center; }
.week-day span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.week-day i { display: grid; place-items: center; aspect-ratio: 1; color: var(--charcoal); background: #eef1f2; border: 1px solid #dfe4e6; font: 900 10px/1 ui-monospace, monospace; font-style: normal; }
.week-day.is-done i { background: var(--cyan); border: 2px solid var(--charcoal); box-shadow: 2px 2px 0 var(--charcoal); }
.week-day.is-today i { background: var(--orange); }
.week-note { margin: 17px 0 0; color: var(--muted); font-size: 11px; }
.week-note span { color: var(--orange); }
.next-reward-card { display: grid; grid-template-columns: 55px 1fr; gap: 14px; align-items: center; }
.reward-mini-icon { display: grid; place-items: center; width: 55px; height: 55px; color: var(--charcoal); background: var(--yellow); border: 2px solid var(--charcoal); box-shadow: 4px 4px 0 var(--charcoal); }
.reward-mini-icon svg { width: 30px; height: 30px; fill: currentColor; }
.next-reward-card strong, .next-reward-card span { display: block; }
.next-reward-card > div > span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.reward-mini-progress { grid-column: 1/-1; height: 8px; margin-top: 4px; background: #edf0f1; }
.reward-mini-progress i { display: block; height: 100%; background: var(--orange); }
.reward-mini-button { grid-column: 1/-1; min-height: 39px; border: 2px solid var(--charcoal); color: var(--charcoal); background: var(--orange); box-shadow: 3px 3px 0 var(--charcoal); font-weight: 900; cursor: pointer; }

.section-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 22px; margin: 8px 0 26px; }
.section-toolbar h2 { font-size: 34px; }
.section-toolbar p { margin: 8px 0 0; color: var(--muted); }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 45px; padding: 0 18px; border: 2px solid var(--charcoal); background: var(--cyan); box-shadow: 4px 4px 0 var(--charcoal); font-weight: 900; cursor: pointer; transition: .1s ease; }
.primary-button.orange { background: var(--orange); }
.primary-button svg { width: 17px; height: 17px; fill: currentColor; }
.primary-button:active, .secondary-button:active { transform: translate(4px,4px); box-shadow: none; }
.secondary-button { background: #fff; box-shadow: none; }
.stats-strip { display: grid; grid-template-columns: repeat(3,1fr); margin-bottom: 22px; background: #fff; border: 1px solid var(--line); }
.stats-strip > div { padding: 19px 22px; border-right: 1px solid var(--line); }
.stats-strip > div:last-child { border-right: 0; }
.stats-strip span, .stats-strip strong { display: block; }
.stats-strip > div > span { color: var(--muted); font-size: 11px; }
.stats-strip strong { margin-top: 7px; font: 900 23px/1 ui-monospace, monospace; }
.stats-strip strong:last-child { display: flex; align-items: center; gap: 8px; }
.habit-catalog { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.habit-card { position: relative; display: grid; grid-template-columns: 58px 1fr; gap: 16px; padding: 20px; background: #fff; border: 1px solid var(--line); box-shadow: 4px 4px 0 rgba(45,49,52,.08); }
.habit-card.is-done { border-color: #91d9ca; background: #f4fcfa; }
.habit-card .habit-icon { width: 54px; height: 54px; }
.habit-card h3 { margin: 2px 0 6px; font-size: 17px; }
.habit-card p { margin: 0; color: var(--muted); font-size: 12px; }
.habit-card-footer { grid-column: 1/-1; display: flex; justify-content: space-between; align-items: center; margin-top: 5px; padding-top: 14px; border-top: 1px solid var(--line); }
.habit-card-footer span { color: var(--muted); font-size: 11px; }

.reward-balance-banner { display: flex; align-items: center; gap: 17px; margin-bottom: 24px; padding: 22px 26px; color: #fff; background: var(--charcoal); border-bottom: 6px solid var(--orange); }
.reward-balance-banner span, .reward-balance-banner strong { display: block; }
.reward-balance-banner div > span { color: #aeb7bb; font-size: 11px; }
.reward-balance-banner strong { margin-top: 3px; font-size: 22px; }
.reward-balance-banner p { margin-left: auto; color: #9ea7ab; font-size: 12px; }
.reward-catalog { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.reward-card { position: relative; padding: 20px; overflow: hidden; background: #fff; border: 1px solid var(--line); box-shadow: 5px 5px 0 rgba(45,49,52,.1); }
.reward-card::before { content: ""; position: absolute; top: 0; right: 0; width: 38px; height: 8px; background: var(--orange); box-shadow: -12px 8px 0 var(--yellow); }
.reward-icon { display: grid; place-items: center; width: 68px; height: 68px; color: var(--charcoal); background: #fff3d3; border: 2px solid var(--charcoal); box-shadow: 5px 5px 0 var(--orange); }
.reward-icon svg { width: 38px; height: 38px; fill: currentColor; }
.reward-card h3 { margin: 21px 0 6px; font-size: 18px; }
.reward-card p { min-height: 35px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.reward-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); }
.cost { display: flex; align-items: center; gap: 7px; font: 900 17px/1 ui-monospace, monospace; }
.claim-button { min-height: 37px; padding: 0 13px; border: 2px solid var(--charcoal); color: var(--charcoal); background: var(--orange); box-shadow: 3px 3px 0 var(--charcoal); font-size: 11px; font-weight: 900; cursor: pointer; }
.claim-button:disabled { color: #9aa0a4; background: #e9ecee; border-color: #aeb4b7; box-shadow: none; cursor: not-allowed; }
.claim-button:not(:disabled):active { transform: translate(3px,3px); box-shadow: none; }

.history-layout { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 22px; }
.history-feed { padding: 12px 22px; }
.history-date { margin: 18px 0 8px; color: var(--muted); font: 900 10px/1 ui-monospace, monospace; text-transform: uppercase; }
.history-item { display: grid; grid-template-columns: 42px 1fr auto; gap: 13px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); }
.history-item:last-child { border-bottom: 0; }
.history-icon { display: grid; place-items: center; width: 40px; height: 40px; color: var(--charcoal); background: var(--cyan-pale); border: 1px solid #bce8f0; }
.history-icon.reward { background: #fff3d5; border-color: #f4d88b; }
.history-icon svg { width: 22px; height: 22px; fill: currentColor; }
.history-main strong, .history-main span { display: block; }
.history-main strong { font-size: 13px; }
.history-main span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.history-points { font: 900 14px/1 ui-monospace, monospace; }
.history-points.positive { color: var(--green); }
.history-points.negative { color: var(--danger); }
.history-summary { align-self: start; padding: 24px; }
.summary-item { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.summary-item:last-child { border-bottom: 0; }
.summary-item span { color: var(--muted); font-size: 12px; }
.summary-item strong { font: 900 18px/1 ui-monospace, monospace; }
.positive { color: var(--green); }
.negative { color: var(--danger); }
.empty-state { padding: 42px 20px; color: var(--muted); text-align: center; }
.empty-state .pixel-empty { display: block; margin-bottom: 12px; color: var(--cyan); font: 900 28px/1 ui-monospace, monospace; }

.modal { width: min(520px, calc(100vw - 28px)); padding: 0; border: 3px solid var(--charcoal); color: var(--ink); background: #fff; box-shadow: 10px 10px 0 var(--charcoal); }
.modal::backdrop { background: rgba(25,28,30,.7); backdrop-filter: blur(3px); }
.modal form { padding: 26px; }
.modal-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 24px; }
.modal-heading h2 { margin: 0; font-size: 27px; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; color: var(--muted); background: #f0f2f3; cursor: pointer; }
.icon-button svg { width: 18px; height: 18px; fill: currentColor; }
.modal label, .modal legend { color: #3e4448; font-size: 12px; font-weight: 800; }
.modal label { display: grid; gap: 8px; margin-top: 17px; }
.modal input, .modal select { width: 100%; height: 47px; padding: 0 13px; border: 2px solid #cfd5d8; border-radius: 0; outline: none; background: #fff; }
.modal input:focus, .modal select:focus { border-color: var(--cyan-dark); box-shadow: 3px 3px 0 var(--cyan); }
.modal fieldset { padding: 0; margin: 17px 0 0; border: 0; }
.modal legend { margin-bottom: 9px; }
.icon-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-choice { display: grid; place-items: center; width: 43px; height: 43px; border: 2px solid #cfd5d8; background: #fff; cursor: pointer; }
.icon-choice svg { width: 22px; height: 22px; fill: var(--charcoal); }
.icon-choice.is-selected { border-color: var(--charcoal); background: var(--cyan); box-shadow: 3px 3px 0 var(--charcoal); }
.modal-actions { display: flex; justify-content: end; gap: 10px; margin-top: 27px; }

.toast { position: fixed; right: 28px; bottom: 28px; z-index: 30; max-width: 360px; padding: 14px 18px; color: #fff; background: var(--charcoal); border-left: 6px solid var(--cyan); box-shadow: 6px 6px 0 rgba(0,0,0,.2); font-size: 13px; font-weight: 800; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .22s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { border-left-color: var(--orange); }
.coin-fly { position: fixed; z-index: 40; display: flex; align-items: center; gap: 9px; opacity: 0; pointer-events: none; }
.coin-fly b { color: var(--orange); font: 900 22px/1 ui-monospace, monospace; text-shadow: 2px 2px 0 var(--charcoal); }
.coin-fly.is-active { animation: coin-pop .8s ease-out both; }
@keyframes coin-pop { 0% { opacity: 0; transform: translateY(12px) scale(.7); } 25% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 0; transform: translateY(-70px) scale(.9); } }

@media (max-width: 1100px) {
  .main-area { grid-column: 2; padding-inline: 28px; }
  .reward-catalog { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar,
  .app-shell.is-sidebar-collapsed .sidebar { position: fixed; inset: auto 0 0; width: auto; height: 70px; flex-direction: row; padding: 8px 12px; }
  .sidebar-toggle { display: none; }
  .brand, .profile-mini,
  .app-shell.is-sidebar-collapsed .brand,
  .app-shell.is-sidebar-collapsed .profile-mini { display: none; }
  .main-nav { width: 100%; grid-template-columns: repeat(4,1fr); gap: 4px; }
  .nav-item { min-height: 54px; }
  .nav-item span { display: none; }
  .main-area { padding: 20px 18px 100px; }
  .topbar { align-items: start; gap: 16px; }
  .topbar-actions { flex-direction: column; }
  .sound-chip, .streak-chip, .balance-chip { min-height: 38px; padding-inline: 10px; }
  .hero-card { grid-template-columns: 1fr; padding: 28px; }
  .hero-coin-stack { display: none; }
  .dashboard-grid, .history-layout { grid-template-columns: 1fr; }
  .habit-catalog, .reward-catalog { grid-template-columns: 1fr; }
  .section-toolbar { align-items: start; flex-direction: column; }
  .stats-strip { grid-template-columns: 1fr; }
  .stats-strip > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .stats-strip > div:last-child { border-bottom: 0; }
  .reward-balance-banner { align-items: start; }
  .reward-balance-banner p { display: none; }
}
@media (max-width: 540px) {
  .topbar h1 { font-size: 24px; }
  .topbar-actions { gap: 5px; }
  .streak-chip span:last-child, .balance-chip span:last-child { display: none; }
  .sound-chip span { display: none; }
  .hero-card { min-height: 0; padding: 24px 20px; box-shadow: 5px 5px 0 var(--charcoal); }
  .hero-copy h2 { font-size: 35px; }
  .habit-row { grid-template-columns: 42px 1fr auto; }
  .habit-row .point-badge { display: none; }
  .habits-today-panel { padding: 18px 14px; }
  .text-button { display: none; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; }
}

@media (max-width: 700px) {
  .profile-account-heading { padding: 17px 16px 13px; }
}

/* Brandbook refinement: soft product UI with pixel details used as accents. */
:root {
  --canvas: #f6f8f9;
  --line: #e7ecee;
  --muted: #778086;
  --shadow: 0 14px 36px rgba(45, 49, 52, .08);
}

.sidebar {
  padding: 30px 18px 20px;
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 191, 227, .12), transparent 34%),
    var(--charcoal);
}
.brand { padding: 4px 10px 38px; }
.brand img { width: 170px; filter: none; }
.main-nav { gap: 7px; }
.nav-item {
  min-height: 52px;
  padding: 0 17px;
  border-radius: 15px;
  color: #b8c0c4;
  font-weight: 650;
}
.nav-item:hover { transform: none; background: rgba(255,255,255,.07); }
.nav-item.is-active {
  color: #172024;
  background: var(--cyan);
  box-shadow: 0 8px 20px rgba(0,191,227,.2);
}
.nav-item.is-active::after { display: none; }
.profile-mini { padding: 12px 9px; border-radius: 14px; }
.profile-mini:hover { background: rgba(255,255,255,.04); }
.avatar {
  border: 0;
  border-radius: 12px;
  box-shadow: 0 0 0 3px rgba(0,191,227,.2);
}
.online-dot { border-radius: 50%; }

.main-area { padding: 34px 44px 54px; }
.topbar { margin-bottom: 32px; }
.eyebrow, .section-kicker {
  letter-spacing: .1em;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.topbar h1 { font-weight: 750; }
.sound-chip, .streak-chip, .balance-chip {
  min-height: 48px;
  border-color: var(--line);
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(45,49,52,.06);
}
.pixel-flame { text-shadow: none; }

.hero-card {
  min-height: 244px;
  padding: 38px 42px;
  border: 0;
  border-radius: 26px;
  background: linear-gradient(125deg, #06c1e4 0%, #00b9db 60%, #21cae8 100%);
  box-shadow: 0 18px 44px rgba(0,145,170,.2);
}
.hero-card::before {
  right: -90px;
  bottom: -120px;
  width: 430px;
  height: 260px;
  border-radius: 50%;
  background: rgba(255,255,255,.13);
  transform: none;
}
.hero-card::after {
  top: -88px;
  left: 56%;
  width: 260px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,.09);
  box-shadow: none;
}
.pixel-label {
  padding: 8px 12px;
  border-radius: 999px;
  box-shadow: none;
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 9px;
}
.hero-copy h2 { font-weight: 780; line-height: 1.02; }
.hero-progress { height: 10px; padding: 0; overflow: hidden; border-radius: 999px; background: rgba(45,49,52,.2); }
.hero-progress i { border-radius: inherit; }
.coin-hero { filter: drop-shadow(0 15px 18px rgba(45,49,52,.25)); }
.coin-back { filter: drop-shadow(0 8px 12px rgba(45,49,52,.2)); }
.pixel-spark { border-radius: 2px; box-shadow: none; }

.dashboard-grid { gap: 24px; margin-top: 26px; }
.panel {
  border-color: var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.habits-today-panel { padding: 28px; }
.habit-list { gap: 9px; }
.habit-row {
  min-height: 72px;
  padding: 11px 13px;
  border-color: #ebeff1;
  border-radius: 15px;
  background: #fbfcfc;
}
.habit-row:hover { transform: translateY(-1px); border-color: #bdeaf2; box-shadow: 0 8px 18px rgba(45,49,52,.05); }
.habit-icon {
  border: 0;
  border-radius: 13px;
  box-shadow: none;
}
.habit-icon svg { shape-rendering: auto; }
.point-badge { border: 0; border-radius: 999px; }
.complete-button {
  border: 2px solid #d8dfe2;
  border-radius: 12px;
  box-shadow: none;
}
.complete-button:hover { border-color: var(--yellow); }
.complete-button:active { transform: scale(.94); }
.habit-row.is-done .complete-button { border-color: var(--cyan); }

.week-panel, .reward-preview-panel { padding: 24px; }
.streak-number {
  border: 0;
  border-radius: 13px;
  box-shadow: 0 7px 16px rgba(252,170,7,.2);
}
.week-day i { border: 0; border-radius: 9px; }
.week-day.is-done i { border: 0; box-shadow: none; }
.reward-mini-icon {
  border: 0;
  border-radius: 15px;
  box-shadow: none;
}
.reward-mini-progress { overflow: hidden; border-radius: 999px; }
.reward-mini-progress i { border-radius: inherit; }
.reward-mini-button {
  border: 0;
  border-radius: 999px;
  box-shadow: none;
}

.primary-button, .secondary-button {
  min-height: 47px;
  padding: 0 21px;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 9px 20px rgba(0,145,170,.18);
  font-weight: 750;
}
.primary-button.orange { box-shadow: 0 9px 20px rgba(252,170,7,.2); }
.primary-button:active, .secondary-button:active { transform: scale(.97); box-shadow: none; }
.secondary-button { border: 1px solid var(--line); box-shadow: none; }
.stats-strip { overflow: hidden; border-radius: 18px; box-shadow: 0 10px 28px rgba(45,49,52,.05); }
.habit-card, .reward-card {
  border-color: var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(45,49,52,.07);
}
.reward-card::before { width: 48px; height: 6px; border-radius: 0 18px 0 8px; box-shadow: none; }
.reward-icon {
  border: 0;
  border-radius: 18px;
  box-shadow: none;
}
.reward-icon.has-photo,
.reward-mini-icon.has-photo {
  overflow: hidden;
  padding: 0;
  background: #edf2f4;
}
.reward-icon.has-photo img,
.reward-mini-icon.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.reward-balance-banner {
  border: 0;
  border-radius: 20px;
  box-shadow: 0 14px 34px rgba(45,49,52,.13);
}
.claim-button {
  border: 0;
  border-radius: 999px;
  box-shadow: none;
}
.claim-button:not(:disabled):active { transform: scale(.96); }
.history-icon { border: 0; border-radius: 12px; }

.modal {
  max-height: calc(100dvh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 24px;
  box-shadow: 0 26px 70px rgba(16,20,22,.25);
}
.modal::backdrop { background: rgba(25,28,30,.55); }
.icon-button { border-radius: 50%; }
.modal input, .modal select {
  border: 1px solid #d7dfe2;
  border-radius: 13px;
  background: #fbfcfc;
}
.modal input:focus, .modal select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,191,227,.14); }
.icon-choice { border: 1px solid #d7dfe2; border-radius: 12px; }
.icon-choice.is-selected { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,191,227,.14); }
.toast { border: 0; border-radius: 14px; box-shadow: 0 16px 34px rgba(0,0,0,.2); }

.reward-photo-field legend span {
  margin-left: 5px;
  color: var(--muted);
  font-weight: 500;
}
.reward-photo-editor { display: grid; gap: 8px; }
.reward-photo-drop {
  position: relative;
  display: grid !important;
  place-items: center;
  min-height: 156px;
  margin-top: 0 !important;
  overflow: hidden;
  border: 1px dashed #afc5cc;
  border-radius: 16px;
  background: #f8fbfc;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.reward-photo-drop:hover {
  border-color: var(--cyan);
  background: #f0fbfd;
  transform: translateY(-1px);
}
.reward-photo-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.reward-photo-placeholder {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 20px;
  text-align: center;
}
.reward-photo-placeholder b { font-size: 31px; }
.reward-photo-placeholder strong { color: var(--ink); font-size: 13px; }
.reward-photo-placeholder small { color: var(--muted); font-size: 10px; font-weight: 500; }
.reward-photo-drop img {
  width: 100%;
  height: 190px;
  object-fit: cover;
}
.reward-photo-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.reward-photo-actions > span { color: var(--muted); font-size: 10px; line-height: 1.4; }
.danger-text-button { flex: 0 0 auto; color: var(--danger); }

.claim-reward-preview .reward-icon.has-photo {
  width: 92px;
  height: 92px;
  border-radius: 20px;
}

.reward-win-modal {
  width: min(560px, calc(100vw - 28px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 30px;
  color: #fff;
  background:
    radial-gradient(circle at 50% 32%, rgba(255,226,28,.28), transparent 33%),
    linear-gradient(145deg, #20282d 0%, #11171b 100%);
  box-shadow: 0 32px 90px rgba(0,0,0,.42);
}
.reward-win-modal::backdrop {
  background: rgba(8,12,14,.76);
  backdrop-filter: blur(7px);
}
.reward-win-content {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  min-height: 610px;
  align-content: center;
  padding: 42px 34px 36px;
  text-align: center;
}
.reward-win-kicker {
  margin-bottom: 22px;
  color: var(--yellow);
  font: 800 10px/1.2 "Press Start 2P", ui-monospace, monospace;
  letter-spacing: .08em;
}
.reward-win-visual {
  display: grid;
  place-items: center;
  width: 184px;
  height: 184px;
  overflow: hidden;
  border: 6px solid #fff;
  border-radius: 50%;
  color: #20282d;
  background: linear-gradient(145deg, #fff6c8, #ffe21c);
  box-shadow: 0 0 0 9px rgba(255,226,28,.17), 0 22px 52px rgba(0,0,0,.34);
}
.reward-win-visual .ui-emoji { font-size: 82px; }
.reward-win-visual.has-photo img { width: 100%; height: 100%; object-fit: cover; }
.reward-win-stars {
  margin: 21px 0 7px;
  color: var(--yellow);
  font-size: 17px;
  letter-spacing: 10px;
}
.reward-win-stars b { font-size: 27px; }
.reward-win-content h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(34px, 8vw, 52px);
  line-height: 1;
}
.reward-win-content > p {
  max-width: 430px;
  margin: 12px 0 0;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
}
.reward-win-cost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 13px;
  padding: 8px 13px;
  border-radius: 999px;
  color: #c7d0d4;
  background: rgba(255,255,255,.08);
  font-size: 12px;
  font-weight: 750;
}
.reward-win-message {
  margin-top: 17px;
  color: var(--cyan);
  font-size: 15px;
}
.reward-win-button { min-width: 220px; margin-top: 25px; }
.reward-win-confetti {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.reward-win-confetti i {
  position: absolute;
  top: -18px;
  left: var(--left);
  width: 9px;
  height: 15px;
  border-radius: 2px;
  background: var(--color);
  opacity: 0;
  transform: rotate(var(--rotate));
}
.reward-win-modal.is-celebrating .reward-win-confetti i {
  animation: reward-confetti var(--duration) cubic-bezier(.16,.72,.33,1) var(--delay) forwards;
}
.reward-win-modal.is-celebrating .reward-win-visual {
  animation: reward-pop .68s cubic-bezier(.18,1.55,.42,1) both;
}
.reward-win-modal.is-celebrating .reward-win-stars {
  animation: reward-glow .9s ease .3s both;
}
@keyframes reward-confetti {
  0% { opacity: 0; transform: translate3d(0,-15px,0) rotate(var(--rotate)); }
  12% { opacity: 1; }
  100% { opacity: .9; transform: translate3d(35px,670px,0) rotate(calc(var(--rotate) + 540deg)); }
}
@keyframes reward-pop {
  0% { opacity: 0; transform: scale(.35) rotate(-8deg); }
  70% { transform: scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes reward-glow {
  0% { opacity: 0; transform: scale(.7); }
  100% { opacity: 1; transform: scale(1); text-shadow: 0 0 22px rgba(255,226,28,.7); }
}
@media (prefers-reduced-motion: reduce) {
  .reward-win-modal.is-celebrating .reward-win-confetti i,
  .reward-win-modal.is-celebrating .reward-win-visual,
  .reward-win-modal.is-celebrating .reward-win-stars { animation: none; opacity: 1; }
}
@media (max-width: 540px), (max-height: 680px) {
  .reward-win-content { min-height: min(560px, calc(100dvh - 28px)); padding: 28px 22px 24px; }
  .reward-win-visual { width: 138px; height: 138px; border-width: 5px; }
  .reward-win-visual .ui-emoji { font-size: 62px; }
  .reward-win-kicker { margin-bottom: 16px; }
  .reward-win-stars { margin-top: 15px; }
  .reward-win-button { margin-top: 20px; }
}

@media (max-width: 1100px) {
  .brand img { width: 170px; }
  .nav-item { border-radius: 14px; }
}
@media (max-width: 820px) {
  .sidebar { border-radius: 20px 20px 0 0; }
  .main-area { padding-top: 22px; }
}
@media (max-width: 540px) {
  .hero-card { border-radius: 20px; box-shadow: 0 14px 32px rgba(0,145,170,.18); }
}

/* Actions: execution and editor */
.editor-toggle,
.category-manager-toggle { display: inline-flex; align-items: center; gap: 9px; }
.actions-toolbar {
  justify-content: flex-end;
  margin-bottom: 16px;
}
.editor-toggle svg, .editor-tools svg, .action-complete svg, .editor-actions svg { width: 18px; height: 18px; fill: currentColor; }
.editor-tools { display: flex; flex-wrap: wrap; gap: 10px; margin: -8px 0 20px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.editor-tools[hidden] { display: none; }
.editor-tools button { display: inline-flex; align-items: center; gap: 8px; }
.editor-tools button:disabled { opacity: .5; cursor: not-allowed; }
.category-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(56px, 82px));
  gap: 9px;
  width: fit-content;
  max-width: 100%;
  max-height: 242px;
  margin: 22px 0 18px;
  padding: 2px 6px 6px 2px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.category-tab {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: #fff;
  cursor: pointer;
  transition: .18s ease;
}
.category-tab:hover { transform: translateY(-2px); border-color: #aae5ef; }
.category-tab.is-active { border-color: var(--cyan); background: var(--cyan-pale); box-shadow: 0 0 0 3px rgba(0,191,227,.1); }
.category-emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 31px; line-height: 1; }
.ui-emoji {
  display: inline-grid;
  place-items: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.25em;
  font-style: normal;
  line-height: 1;
}
.habit-icon .ui-emoji, .reward-icon .ui-emoji, .reward-mini-icon .ui-emoji, .history-icon .ui-emoji { font-size: 30px; }
.complete-button .ui-emoji, .action-complete .ui-emoji { font-family: inherit; font-size: 1.15em; font-weight: 900; }
.category-tab.add-category { min-width: 0; border-style: dashed; }
.category-tab.add-category > svg { width: 22px; height: 22px; fill: var(--cyan-dark); }

.category-manager-modal {
  width: min(680px, calc(100vw - 32px));
  max-width: 680px;
  padding: 26px;
}
.category-manager {
  display: grid;
  gap: 18px;
}
.category-manager .modal-heading {
  align-items: flex-start;
  margin-bottom: 0;
}
.category-manager .modal-heading p {
  max-width: 500px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.category-add-button {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.category-manager-list {
  display: grid;
  gap: 8px;
  padding: 2px;
}
.category-manager-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  transition: border-color .15s ease, background .15s ease, opacity .15s ease, transform .15s ease;
}
.category-manager-item:hover { border-color: #b7dfe7; }
.category-manager-item.is-dragging { opacity: .45; }
.category-manager-item.is-drop-target {
  border-color: var(--cyan);
  background: var(--cyan-pale);
  transform: translateY(2px);
}
.category-manager-drag {
  color: #98a2a7;
  font-size: 22px;
  line-height: 1;
  cursor: grab;
  user-select: none;
}
.category-manager-drag:active { cursor: grabbing; }
.category-manager-main {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  text-align: left;
  background: transparent;
  cursor: pointer;
}
.category-manager-main:hover .category-manager-copy strong,
.category-manager-main:focus-visible .category-manager-copy strong {
  color: var(--cyan-dark);
}
.category-manager-main:focus-visible {
  border-radius: 12px;
  outline: 3px solid rgba(0, 191, 227, .2);
  outline-offset: 3px;
}
.category-manager-emoji {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #effafd;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 25px;
}
.category-manager-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}
.category-manager-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.category-manager-copy span {
  color: var(--muted);
  font-size: 11px;
}
.category-manager-order {
  display: flex;
  gap: 5px;
}
.category-manager-order button,
.category-manager-edit,
.category-manager-delete {
  border: 1px solid var(--line);
  color: #606a70;
  background: #fff;
  cursor: pointer;
}
.category-manager-order button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 850;
}
.category-manager-order button:hover:not(:disabled),
.category-manager-edit:hover {
  color: var(--cyan-dark);
  border-color: var(--cyan);
}
.category-manager-delete:hover:not(:disabled) {
  color: #c73333;
  border-color: #ef9d9d;
  background: #fff7f7;
}
.category-manager-order button:disabled {
  opacity: .28;
  cursor: default;
}
.category-manager-edit,
.category-manager-delete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 11px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 750;
}
.category-manager-edit > span:first-child {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 16px;
}
.category-manager-delete > span:first-child {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 16px;
}
.category-manager-delete:disabled {
  opacity: .35;
  cursor: default;
}
.delete-category-preview {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid #f0c6c6;
  border-radius: 14px;
  background: #fff8f8;
}
.delete-category-preview strong {
  color: var(--ink);
  font-size: 16px;
}
.delete-category-preview p,
.delete-category-warning {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.delete-category-warning {
  color: #b62f2f;
  font-weight: 750;
}
.danger-button {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: #d83b3b;
  font-weight: 800;
  cursor: pointer;
}
.danger-button:hover { background: #bd2f2f; }
.category-manager-hint {
  margin: -4px 2px 0;
  color: var(--muted);
  font-size: 10px;
}
.category-manager-empty {
  display: grid;
  justify-items: center;
  min-height: 220px;
  align-content: center;
  padding: 24px;
  border: 1px dashed #cdd7da;
  border-radius: 16px;
  text-align: center;
  background: #fbfcfc;
}
.category-manager-empty > span { margin-bottom: 12px; font-size: 34px; }
.category-manager-empty strong { color: var(--ink); font-size: 16px; }
.category-manager-empty p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }

.habit-catalog { display: grid; gap: 8px; }
.action-card {
  display: grid;
  grid-template-columns: auto 48px minmax(0,1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 80px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(45,49,52,.055);
}
.habit-catalog:not(.is-editor) .action-card { grid-template-columns: 48px minmax(0,1fr); }
.action-card.is-done { background: #f8fcfb; border-color: #cbe9df; }
.action-card .habit-icon {
  width: 48px;
  height: 48px;
  border-radius: 11px;
}
.drag-handle { color: #a7afb4; font-size: 23px; cursor: grab; user-select: none; }
.action-main { min-width: 0; }
.action-main h3 { margin: 0 0 3px; font-size: 15px; line-height: 1.22; }
.action-main p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.25; }
.action-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 5px; }
.action-meta { display: flex; flex-wrap: wrap; gap: 10px; min-width: 0; color: #596166; font-size: 11px; font-weight: 700; }
.action-meta span { display: inline-flex; align-items: center; gap: 5px; }
.completion-count {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  cursor: help;
}
.completion-count::after {
  position: absolute;
  z-index: 20;
  left: 50%;
  bottom: calc(100% + 9px);
  width: max-content;
  max-width: 190px;
  padding: 7px 9px;
  border-radius: 8px;
  color: #fff;
  background: #20272b;
  box-shadow: 0 8px 22px rgba(0,0,0,.18);
  content: attr(data-tooltip);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: .15s ease;
}
.completion-count:hover::after,
.completion-count:focus-visible::after,
.completion-count:focus::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.action-meta svg { width: 14px; height: 14px; fill: var(--cyan-dark); }
.action-complete {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 96px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--green) 72%, #066b56);
  border-radius: 10px;
  color: #fff;
  background: var(--green);
  font: inherit;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  transition: .15s ease;
}
.action-complete:hover { filter: brightness(.95); transform: translateY(-1px); }
.action-complete:active { transform: translateY(0); }
.action-complete.is-complete { color: #17604d; border-color: #b6dbcf; background: #e6f4ef; }
.action-complete.is-complete:hover { border-color: var(--green); background: #d8eee7; }
.action-complete.is-unavailable,
.action-complete:disabled {
  color: #7d8b85;
  border-color: #d4dfdb;
  background: #eef3f1;
  cursor: default;
  filter: none;
  transform: none;
}
.action-complete-check { font-size: 14px; line-height: .8; }
.action-complete-label { white-space: nowrap; }
.editor-actions { display: flex; gap: 7px; }
.editor-actions button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #697176;
  background: #fff;
  cursor: pointer;
}
.editor-actions button:hover { color: var(--cyan-dark); border-color: var(--cyan); }
.editor-actions button:last-child:hover { color: var(--danger); border-color: var(--danger); }

.form-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 14px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
#habitModal { width: min(680px, calc(100vw - 28px)); max-height: min(880px, calc(100vh - 28px)); overflow: auto; }
.modal label small { margin-top: 5px; color: var(--muted); font-size: 11px; font-weight: 500; }
.modal-small { max-width: 480px; }
.action-mode-field { margin-top: 18px !important; }
.action-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.action-mode-switch label { margin: 0; cursor: pointer; }
.action-mode-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.action-mode-switch span {
  display: grid;
  align-content: center;
  min-height: 70px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: .15s ease;
}
.action-mode-switch b { color: var(--ink); font-size: 12px; }
.action-mode-switch small { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 600; line-height: 1.3; }
.action-mode-switch input:checked + span { border-color: var(--cyan-dark); background: #eafaff; box-shadow: 0 0 0 2px rgba(0,191,227,.12); }
.action-mode-switch input:focus-visible + span { outline: 3px solid rgba(0,191,227,.25); outline-offset: 2px; }
.multi-variants-field { padding-top: 4px !important; }
.multi-variants-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.multi-variants-heading > div { display: grid; gap: 4px; }
.multi-variants-heading b { color: #3e4448; font-size: 12px; font-weight: 800; }
.multi-variants-heading small { color: var(--muted); font-size: 10px; }
.multi-variants-heading .secondary-button { min-height: 34px; padding: 0 11px; font-size: 10px; }
.multi-variant-list { display: grid; gap: 8px; }
.multi-variant-row {
  display: grid;
  grid-template-columns: 26px minmax(0,1fr) 92px 34px;
  align-items: end;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafb;
}
.multi-variant-number { align-self: center; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; color: #087689; background: #dff7fb; font-size: 10px; font-weight: 900; }
.multi-variant-row label { gap: 5px; margin: 0; font-size: 9px; }
.multi-variant-row input { height: 39px; padding-inline: 10px; }
.multi-variant-actions { display: flex; align-items: end; padding-bottom: 1px; }
.multi-variant-actions button {
  width: 30px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}
.multi-variant-actions button:hover:not(:disabled) { color: var(--cyan-dark); border-color: var(--cyan); }
.multi-variant-actions button:last-child:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }
.multi-variant-actions button:disabled { opacity: .3; cursor: default; }
.multi-complete-dialog { padding: 22px; }
.multi-complete-modal .modal-heading { margin-bottom: 14px; }
.multi-complete-modal .modal-heading h2 { font-size: 23px; }
.multi-complete-modal .modal-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.multi-complete-list { display: grid; gap: 8px; }
.multi-complete-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  width: 100%;
  min-height: 52px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: .15s ease;
}
.multi-complete-option:hover { border-color: var(--cyan); background: #f0fbfd; transform: translateY(-1px); }
.multi-complete-option span { font-size: 12px; font-weight: 800; }
.multi-complete-option strong { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; color: #087689; font-size: 11px; }
.multi-complete-cancel { width: 100%; margin-top: 12px; }
.history-variant { display: block; margin-top: 2px; color: var(--cyan-dark); font-size: 11px; font-weight: 800; }
.weekday-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekday-picker button {
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.weekday-picker button.is-selected { color: #fff; border-color: var(--cyan-dark); background: var(--cyan-dark); }
.history-item { grid-template-columns: auto minmax(0,1fr) auto auto; }
.history-item.is-cancelled { opacity: .48; }
.history-undo {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
}
.toast { display: flex; align-items: center; gap: 14px; }
.toast button { padding: 6px 9px; border: 0; border-radius: 8px; color: var(--charcoal); background: #fff; font-weight: 800; cursor: pointer; }
.complete-button:disabled { cursor: default; opacity: .75; }

@media (max-width: 720px) {
  .section-toolbar { align-items: flex-start; gap: 16px; }
  .actions-toolbar { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px; }
  .editor-toggle, .category-manager-toggle { width: 100%; justify-content: center; padding-inline: 12px; }
  .editor-tools > button { flex: 1 1 180px; justify-content: center; }
  .category-tabs { grid-template-columns: repeat(5, minmax(46px, 1fr)); width: 100%; max-height: min(232px, calc(60vw - 22px)); gap: 7px; }
  .category-tab { width: 100%; max-width: 72px; border-radius: 15px; }
  .category-emoji { font-size: 27px; }
  .action-card {
    grid-template-columns: 44px minmax(0,1fr) auto;
    gap: 9px;
    min-height: 76px;
    padding: 9px 10px;
  }
  .habit-catalog:not(.is-editor) .action-card { grid-template-columns: 44px minmax(0,1fr); }
  .action-card .habit-icon { width: 44px; height: 44px; }
  .action-main h3 { font-size: 14px; }
  .action-main p { font-size: 10px; }
  .drag-handle { display: none; }
  .action-complete { min-width: 88px; height: 29px; padding-inline: 8px; font-size: 9px; }
  .editor-actions { grid-column: 1 / -1; width: 100%; justify-content: center; }
  .editor-actions button { flex: 1; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .action-mode-switch { grid-template-columns: 1fr; }
  .multi-variants-heading { align-items: stretch; flex-direction: column; }
  .multi-variant-row { grid-template-columns: 25px minmax(0,1fr) 74px 32px; gap: 6px; padding: 8px; }
  .multi-variant-row input { padding-inline: 8px; }
  .multi-variant-actions button { width: 32px; }
  .weekday-picker { grid-template-columns: repeat(4, 1fr); }
  .history-item { grid-template-columns: auto minmax(0,1fr) auto; }
  .history-undo { grid-column: 2 / -1; justify-self: start; }
  .category-manager-modal {
    width: min(620px, calc(100vw - 20px));
    padding: 20px 16px;
  }
  .category-manager-item {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: 10px;
    min-height: 68px;
    padding: 9px 10px;
  }
  .category-manager-drag { display: none; }
  .category-manager-main { grid-template-columns: 42px minmax(0, 1fr); gap: 10px; }
  .category-manager-emoji { width: 42px; height: 42px; border-radius: 12px; font-size: 22px; }
  .category-manager-order { grid-column: 2; grid-row: 1; }
  .category-manager-edit {
    grid-column: 3;
    grid-row: 1;
    justify-content: center;
    width: 36px;
    min-height: 36px;
    padding: 0;
  }
  .category-manager-delete {
    grid-column: 4;
    grid-row: 1;
    justify-content: center;
    width: 36px;
    min-height: 36px;
    padding: 0;
  }
  .category-manager-edit-label,
  .category-manager-delete-label { display: none; }
  .category-manager-hint { display: none; }
}

/* Home dashboard: compact hierarchy based on the mobile reference. */
.home-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}
.home-profile-card,
.home-goal-card {
  min-height: 224px;
  border-radius: 22px;
}
.home-profile-card {
  position: relative;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  gap: 16px;
  padding: 24px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 88% 10%, rgba(0,191,227,.25), transparent 34%),
    linear-gradient(135deg, #24282b 0%, #31373a 100%);
  box-shadow: 0 18px 40px rgba(23,29,32,.17);
}
.home-profile-card::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -62px;
  width: 160px;
  height: 160px;
  border: 28px solid rgba(255,255,255,.035);
  border-radius: 50%;
}
.home-avatar {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 3px solid var(--cyan);
  border-radius: 18px;
  color: #252a2d;
  background: var(--orange);
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 0 0 4px rgba(255,255,255,.08);
}
.avatar.has-photo,
.home-avatar.has-photo,
.drawer-avatar.has-photo { padding: 0; overflow: hidden; background: #fff; }
.home-profile-copy { position: relative; z-index: 1; align-self: center; min-width: 0; }
.home-profile-copy > span {
  color: #73d9eb;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .11em;
}
.home-profile-copy h2 { margin: 5px 0 4px; font-size: 24px; }
.home-profile-copy p { margin: 0; color: #aeb7bb; font-size: 12px; }
.home-balance {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  align-self: start;
  min-height: 58px;
  padding: 7px 13px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 17px;
  color: #fff;
  background: rgba(8,12,14,.28);
  cursor: pointer;
}
.home-balance > span:last-child { display: grid; text-align: left; }
.home-balance strong { color: var(--orange); font-size: 24px; line-height: 1; }
.home-balance small { margin-top: 4px; color: #aeb7bb; font-size: 10px; }
.home-daily-progress {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  align-self: end;
}
.home-daily-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 9px;
  color: #c9d0d3;
  font-size: 11px;
}
.home-daily-progress strong { color: #fff; font-size: 12px; }
.home-profile-card .hero-progress {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,.15);
}
.home-profile-card .hero-progress i { background: var(--cyan); }

.home-goal-card {
  margin-bottom: 18px;
  min-height: 0;
  padding: 16px 18px 17px;
  border: 1px solid #b9e9f1;
  border-radius: 18px;
  background: linear-gradient(150deg, #f1fcfe 0%, #fff 62%);
  box-shadow: 0 14px 34px rgba(45,49,52,.075);
}
.home-card-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.home-card-heading .section-kicker { margin: 0; }
.goal-change-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #8dd6e4;
  border-radius: 999px;
  color: var(--cyan-dark);
  background: rgba(255,255,255,.7);
  font-size: 10px;
  font-weight: 850;
  cursor: pointer;
}
.goal-change-button:hover { border-color: var(--cyan); background: #fff; }
.goal-change-button > span { font-size: 14px; line-height: 1; }
.home-goal-card .next-reward-card {
  grid-template-columns: 48px minmax(0,1fr) minmax(96px, 124px);
  gap: 7px 11px;
}
.home-goal-card .reward-mini-icon {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  color: #262b2e;
  background: var(--orange);
}
.home-goal-card .reward-mini-progress {
  grid-column: 1 / -1;
  height: 7px;
  margin-top: 2px;
  background: #e7edef;
}
.home-goal-card .reward-mini-progress i { background: var(--cyan); }
.home-goal-card .reward-mini-button {
  grid-column: 3;
  grid-row: 1;
  min-height: 38px;
  padding: 0 10px;
  color: #fff;
  background: var(--charcoal);
  font-size: 11px;
}
.home-goal-card .reward-mini-button:disabled { color: #677075; background: #dfe5e7; }
.goal-reward-copy { display: grid; align-content: center; gap: 3px; min-width: 0; }
.goal-reward-copy h2 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  line-height: 1.15;
  letter-spacing: -.02em;
}
.goal-reward-copy > span { color: var(--muted); font-size: 10px; }
.goal-reward-copy > strong { font-size: 11px; }
.goal-empty-select { display: grid; gap: 12px; }
.goal-select-button {
  display: grid;
  grid-template-columns: 34px 1fr 18px;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 64px;
  padding: 10px 14px;
  color: var(--ink);
  border: 2px dashed #8dd6e4;
  border-radius: 15px;
  background: rgba(255,255,255,.58);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.goal-select-button:hover { border-color: var(--cyan); background: #fff; transform: translateY(-1px); }
.goal-select-button > span:first-child { font-size: 23px; }
.goal-select-button > span:last-child { color: var(--muted); font-size: 25px; }
.goal-empty-state {
  display: grid;
  grid-template-columns: 54px minmax(0,1fr) auto;
  align-items: center;
  gap: 14px;
}
.goal-empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: #fff0d1;
  font-size: 26px;
}
.goal-empty-state strong { display: block; margin: 4px 0; font-size: 17px; }
.goal-empty-state p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.goal-picker-modal { width: min(620px, calc(100% - 28px)); }
.goal-picker { padding: 26px; }
.goal-picker-list { display: grid; gap: 9px; max-height: min(560px, 62vh); overflow: auto; padding-right: 3px; }
.goal-picker-item {
  display: grid;
  grid-template-columns: 46px minmax(0,1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 68px;
  padding: 9px 11px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}
.goal-picker-item:hover,
.goal-picker-item.is-selected { border-color: var(--cyan); background: #effcff; }
.goal-picker-item.is-selected { box-shadow: inset 3px 0 0 var(--cyan); }
.goal-picker-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border-radius: 12px;
  background: #fff0d1;
  font-size: 22px;
}
.goal-picker-icon.has-photo img { width: 100%; height: 100%; object-fit: cover; }
.goal-picker-copy,
.goal-picker-cost { display: grid; gap: 4px; min-width: 0; }
.goal-picker-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.goal-picker-copy small,
.goal-picker-cost small { color: var(--muted); font-size: 10px; }
.goal-picker-cost { justify-items: end; text-align: right; }
.goal-picker-cost b { display: flex; align-items: center; gap: 5px; color: #8d2bc2; font-size: 13px; }
.goal-picker-cost small.is-available { color: #08a865; font-weight: 800; }
.goal-picker-empty { display: grid; justify-items: center; padding: 30px 16px 12px; text-align: center; }
.goal-picker-empty > span { font-size: 38px; }
.goal-picker-empty strong { margin-top: 10px; font-size: 18px; }
.goal-picker-empty p { max-width: 360px; margin: 7px 0 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.home-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.home-stat-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  min-height: 94px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 9px 24px rgba(45,49,52,.055);
}
.home-stat-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
}
.home-stat-icon svg { width: 21px; height: 21px; fill: currentColor; }
.stat-streak .home-stat-icon { color: #d16b28; background: #fff0e6; }
.stat-today .home-stat-icon { color: #078b67; background: #e5f8f1; }
.stat-plan .home-stat-icon { color: #2772b9; background: #e9f3ff; }
.stat-total .home-stat-icon { color: #8d3794; background: #f8eafa; }
.home-stat-card strong { align-self: end; font-size: 24px; line-height: 1; }
.home-stat-card small { align-self: start; margin-top: 6px; color: var(--muted); font-size: 10px; }

.home-actions-panel { padding: 24px; }
.home-actions-panel .habit-list { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.home-actions-panel .habit-row { min-width: 0; }

@media (max-width: 1120px) {
  .home-overview { grid-template-columns: 1fr; }
  .home-profile-card, .home-goal-card { min-height: 0; }
  .home-actions-panel .habit-list { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .main-area { padding: 18px 16px calc(104px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 52px; margin-bottom: 18px; }
  .topbar h1 { font-size: 26px; }
  .topbar .eyebrow { margin-bottom: 3px; font-size: 8px; }
  .topbar-actions { flex-direction: row; align-items: center; }
  .streak-chip { display: none; }
  .sound-chip, .balance-chip { min-width: 42px; min-height: 42px; padding: 0 10px; box-shadow: none; }

  .sidebar,
  .app-shell.is-sidebar-collapsed .sidebar {
    inset: auto 0 0;
    width: auto;
    height: auto;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(45,49,52,.08);
    border-radius: 0;
    color: #717b80;
    background: rgba(255,255,255,.94);
    box-shadow: 0 -10px 30px rgba(26,33,36,.09);
    backdrop-filter: blur(16px);
  }
  .main-nav {
    grid-template-columns: repeat(5, minmax(0,1fr));
    gap: 5px;
    width: min(100%, 540px);
    margin: 0 auto;
  }
  .nav-item,
  .app-shell.is-sidebar-collapsed .nav-item {
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    min-height: 58px;
    padding: 5px 4px;
    border-radius: 14px;
    color: #778187;
    text-align: center;
  }
  .nav-item svg { width: 24px; height: 24px; }
  .nav-item span,
  .app-shell.is-sidebar-collapsed .nav-item span {
    display: block;
    font-size: 10px;
    font-weight: 750;
  }
  .profile-identity-card { grid-template-columns: 56px minmax(0,1fr) auto; gap: 12px; padding: 15px; }
  .profile-avatar-large { width: 54px; height: 54px; border-radius: 16px; font-size: 23px; }
  .profile-identity-copy h2 { margin-bottom: 4px; font-size: 20px; }
  .profile-identity-copy p { font-size: 11px; }
  .profile-edit-button { width: 38px; min-height: 38px; padding: 0; border-radius: 11px; }
  .profile-edit-button span { display: none; }
  .profile-edit-button svg { width: 17px; height: 17px; }
  .profile-stats { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .profile-stat {
    grid-template-columns: 1fr;
    grid-template-rows: 26px auto auto;
    justify-items: center;
    min-height: 82px;
    padding: 9px 3px;
    text-align: center;
  }
  .profile-stat-icon {
    grid-row: auto;
    width: 26px;
    height: 26px;
    border-radius: 8px;
  }
  .profile-stat-icon svg { width: 14px; height: 14px; }
  .profile-stats strong { font-size: 19px; }
  .profile-stats small { margin-top: 3px; font-size: 7px; line-height: 1.15; }
  .profile-stat::after { width: 205px; max-width: min(205px, calc(100vw - 40px)); }
  .profile-stat:first-child::after { left: 8px; transform: translate(0, 4px); }
  .profile-stat:first-child:hover::after,
  .profile-stat:first-child:focus-visible::after,
  .profile-stat:first-child.is-tooltip-open::after { transform: translate(0, 0); }
  .profile-stat:first-child::before { left: 50%; }
  .profile-stat:last-child::after { right: 8px; left: auto; transform: translate(0, 4px); }
  .profile-stat:last-child:hover::after,
  .profile-stat:last-child:focus-visible::after,
  .profile-stat:last-child.is-tooltip-open::after { transform: translate(0, 0); }
  .profile-settings-card { padding: 18px 15px; }
  .profile-form { grid-template-columns: 1fr; }
  .profile-avatar-setting { grid-template-columns: 58px minmax(0,1fr); padding: 12px; }
  .profile-avatar-setting-preview { width: 54px; height: 54px; border-radius: 15px; font-size: 22px; }
  .profile-avatar-setting-actions { grid-column: 1 / -1; }
  .profile-avatar-setting-actions .secondary-button { flex: 1; }
  .profile-form-actions { grid-column: auto; align-items: stretch; flex-direction: column; }
  .profile-form-actions > div { display: grid; grid-template-columns: 1fr 1fr; }
  .profile-form-actions .primary-button { width: 100%; }
  .profile-account-heading { padding: 17px 16px 11px; }
  .profile-account-actions > button { padding-inline: 13px; }
  .nav-item:hover { color: #40484c; background: #f2f5f6; }
  .nav-item.is-active {
    color: #172024;
    background: var(--cyan);
    box-shadow: 0 8px 18px rgba(0,191,227,.23);
  }

  .home-overview { gap: 12px; }
  .home-profile-card { padding: 19px; border-radius: 19px; }
  .home-goal-card { padding: 14px 15px 15px; border-radius: 17px; }
  .home-stats { gap: 8px; margin: 12px 0; }
  .home-stat-card {
    grid-template-columns: 1fr;
    grid-template-rows: 34px auto auto;
    justify-items: center;
    min-height: 112px;
    padding: 12px 6px;
    text-align: center;
  }
  .home-stat-icon { grid-row: auto; width: 34px; height: 34px; border-radius: 11px; }
  .home-stat-icon svg { width: 18px; height: 18px; }
  .home-stat-card strong { font-size: 22px; }
  .home-stat-card small { font-size: 9px; line-height: 1.2; }
  .home-actions-panel { padding: 18px 14px; border-radius: 19px; }
  .home-actions-panel .panel-heading { margin-bottom: 14px; }
  .goal-empty-state { grid-template-columns: 44px minmax(0,1fr); }
  .goal-empty-icon { width: 44px; height: 44px; border-radius: 13px; font-size: 22px; }
  .goal-empty-state .primary-button { grid-column: 1 / -1; width: 100%; }
  .goal-picker-modal { width: min(520px, calc(100% - 20px)); }
  .goal-picker-list { max-height: 60vh; }
}

@media (max-width: 540px) {
  .topbar-actions .sound-chip span,
  .topbar-actions .theme-chip span:last-child,
  .topbar-actions .balance-chip span:last-child { display: none; }
  .home-profile-card {
    grid-template-columns: 54px minmax(0,1fr) auto;
    gap: 12px;
  }
  .home-avatar { width: 52px; height: 52px; border-radius: 15px; font-size: 22px; }
  .home-profile-copy h2 { font-size: 20px; }
  .home-goal-card .next-reward-card {
    grid-template-columns: 44px minmax(0,1fr) minmax(88px, 108px);
    gap: 7px 9px;
  }
  .home-goal-card .reward-mini-icon { width: 44px; height: 44px; }
  .goal-reward-copy h2 { font-size: 14px; }
  .goal-reward-copy > span { display: none; }
  .home-goal-card .reward-mini-button { min-height: 36px; padding-inline: 8px; font-size: 10px; }
  .goal-change-button { min-height: 28px; padding-inline: 9px; }
  .home-balance { min-height: 48px; padding: 6px 9px; border-radius: 14px; }
  .home-balance .coin-medium { width: 34px; height: 34px; }
  .home-balance strong { font-size: 19px; }
  .home-card-heading h2 { font-size: 20px; }
  .home-actions-panel .habit-row { grid-template-columns: 42px minmax(0,1fr) auto; }
}

/* Category emoji picker */
.icon-picker.is-emoji-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 9px;
  width: 100%;
  padding: 11px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #f8fafb;
}
#categoryIconPicker {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.modal:has(.icon-picker.is-emoji-picker) {
  width: min(620px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
}
.modal:has(.icon-picker.is-emoji-picker) form {
  max-height: none;
  overflow: visible;
}
.emoji-choice {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  height: auto;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: clamp(20px, 3vw, 25px);
  line-height: 1;
}
.emoji-choice.is-system-icon {
  cursor: help;
  border-style: dashed;
  background: #eef1f2;
}
.emoji-choice.is-system-icon > span {
  opacity: .42;
  filter: grayscale(.5);
}
.emoji-choice.is-system-icon:hover,
.emoji-choice.is-system-icon:focus-visible,
.emoji-choice.is-system-icon.is-tooltip-open {
  border-color: #8b969b;
  background: #e9edef;
  transform: none;
  box-shadow: none;
}
.emoji-choice.is-system-icon:hover > span,
.emoji-choice.is-system-icon:focus-visible > span,
.emoji-choice.is-system-icon.is-tooltip-open > span {
  opacity: .62;
}
.system-icon-help {
  grid-column: 1 / -1;
  display: none;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  padding: 11px 13px;
  color: var(--ink);
  border: 1px solid #b9c3c8;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(45,49,52,.12);
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
}
.system-icon-help > span:first-child {
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 1.2;
}
.icon-picker.is-emoji-picker:has(.is-system-icon:hover) .system-icon-help,
.icon-picker.is-emoji-picker:has(.is-system-icon:focus-visible) .system-icon-help,
.icon-picker.is-emoji-picker:has(.is-system-icon.is-tooltip-open) .system-icon-help {
  display: flex;
}
.history-category {
  width: fit-content;
  margin-top: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--cyan-dark) !important;
  background: var(--cyan-pale);
  font-size: 10px !important;
  font-weight: 750;
}
.history-category.is-deleted {
  color: #7a6565 !important;
  background: #f2eeee;
}

/* The profile header stays light in the default theme. */
.home-profile-card {
  color: var(--ink);
  border: 1px solid #b9e9f1;
  background:
    radial-gradient(circle at 88% 10%, rgba(0,191,227,.15), transparent 34%),
    linear-gradient(145deg, #f0fbfd 0%, #ffffff 68%);
  box-shadow: 0 14px 34px rgba(45,49,52,.08);
}
.home-profile-card::after { border-color: rgba(0,145,170,.045); }
.home-profile-copy > span { color: var(--cyan-dark); }
.home-profile-copy h2 { color: var(--ink); }
.home-balance {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255,255,255,.82);
}
.home-balance small { color: var(--muted); }
.home-daily-progress > div:first-child { color: var(--muted); }
.home-daily-progress strong { color: var(--ink); }
.home-profile-card .hero-progress { background: #dcebed; }

/* Night theme */
:root[data-theme="dark"] {
  color-scheme: dark;
  --charcoal: #242b32;
  --ink: #edf3f5;
  --muted: #9aa8af;
  --line: #34424a;
  --surface: #182129;
  --canvas: #0f171e;
  --cyan-pale: #10313a;
  --shadow: 0 10px 28px rgba(0,0,0,.24);
}
:root[data-theme="dark"] body { background: var(--canvas); }
:root[data-theme="dark"] .main-area { background: var(--canvas); }
:root[data-theme="dark"] .topbar { background: rgba(15,21,26,.94); }
:root[data-theme="dark"] .theme-chip,
:root[data-theme="dark"] .sound-chip,
:root[data-theme="dark"] .streak-chip,
:root[data-theme="dark"] .balance-chip,
:root[data-theme="dark"] .secondary-button,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .habit-row,
:root[data-theme="dark"] .stats-strip,
:root[data-theme="dark"] .habit-card,
:root[data-theme="dark"] .reward-card,
:root[data-theme="dark"] .category-tab,
:root[data-theme="dark"] .action-card,
:root[data-theme="dark"] .editor-tools,
:root[data-theme="dark"] .home-stat-card,
:root[data-theme="dark"] .reward-view-switch,
:root[data-theme="dark"] .reward-editor-actions button,
:root[data-theme="dark"] .editor-actions button,
:root[data-theme="dark"] .history-undo,
:root[data-theme="dark"] .weekday-picker button,
:root[data-theme="dark"] .category-manager-item,
:root[data-theme="dark"] .category-manager-order button,
:root[data-theme="dark"] .category-manager-edit,
:root[data-theme="dark"] .category-manager-delete {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
  box-shadow: none;
}
:root[data-theme="dark"] .weekday-picker button.is-selected {
  color: #07171d;
  border-color: var(--cyan);
  background: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0, 191, 227, .18);
}
:root[data-theme="dark"] .category-manager-main { color: inherit; }
:root[data-theme="dark"] .home-profile-card,
:root[data-theme="dark"] .home-goal-card {
  color: var(--ink);
  border-color: #2d535c;
  background:
    radial-gradient(circle at 88% 10%, rgba(0,191,227,.14), transparent 34%),
    linear-gradient(145deg, #18252c 0%, #182129 68%);
  box-shadow: var(--shadow);
}
:root[data-theme="dark"] .home-profile-card::after { border-color: rgba(255,255,255,.025); }
:root[data-theme="dark"] .home-balance {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(8,14,18,.38);
}
:root[data-theme="dark"] .home-profile-card .hero-progress,
:root[data-theme="dark"] .home-goal-card .reward-mini-progress { background: #314149; }
:root[data-theme="dark"] .home-profile-copy h2,
:root[data-theme="dark"] .home-daily-progress strong,
:root[data-theme="dark"] .home-card-heading h2,
:root[data-theme="dark"] .reward-empty strong,
:root[data-theme="dark"] .claim-confirm-copy strong { color: var(--ink); }
:root[data-theme="dark"] .category-tab.is-active {
  border-color: var(--cyan);
  background: #123943;
  box-shadow: 0 0 0 3px rgba(0,191,227,.1);
}
:root[data-theme="dark"] .action-card.is-done { border-color: #285747; background: #172822; }
:root[data-theme="dark"] .action-meta { color: #aebbc1; }
:root[data-theme="dark"] .action-mode-switch span,
:root[data-theme="dark"] .multi-complete-option,
:root[data-theme="dark"] .multi-variant-actions button { color: var(--ink); border-color: var(--line); background: var(--surface); }
:root[data-theme="dark"] .action-mode-switch input:checked + span { border-color: var(--cyan); background: #123943; box-shadow: 0 0 0 2px rgba(0,191,227,.1); }
:root[data-theme="dark"] .multi-variant-row { border-color: var(--line); background: #111a21; }
:root[data-theme="dark"] .multi-variants-heading b { color: var(--ink); }
:root[data-theme="dark"] .multi-complete-option:hover { border-color: var(--cyan); background: #12343d; }
:root[data-theme="dark"] .history-variant { color: #70d9ea; }
:root[data-theme="dark"] .action-complete.is-complete {
  color: #b8eadb;
  border-color: #326b5a;
  background: #1d3d34;
}
:root[data-theme="dark"] .action-complete.is-complete:hover { border-color: #4b9d83; background: #244b40; }
:root[data-theme="dark"] .action-complete.is-unavailable,
:root[data-theme="dark"] .action-complete:disabled {
  color: #7f8c91;
  border-color: #344249;
  background: #202b30;
}
:root[data-theme="dark"] .habit-icon { color: #bfeef6; background: #12343d; }
:root[data-theme="dark"] .modal {
  color: var(--ink);
  border-color: #40515a;
  background: #172129;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
:root[data-theme="dark"] .modal input,
:root[data-theme="dark"] .modal select,
:root[data-theme="dark"] .modal textarea {
  color: var(--ink);
  border-color: #3a4a53;
  background: #101820;
}
:root[data-theme="dark"] .modal input::placeholder,
:root[data-theme="dark"] .modal textarea::placeholder { color: #718089; }
:root[data-theme="dark"] .icon-picker.is-emoji-picker,
:root[data-theme="dark"] .claim-balance-preview,
:root[data-theme="dark"] .archive-reward-preview,
:root[data-theme="dark"] .reward-empty,
:root[data-theme="dark"] .reward-card.is-archived,
:root[data-theme="dark"] .category-manager-empty {
  color: var(--ink);
  border-color: var(--line);
  background: #111a21;
}
:root[data-theme="dark"] .icon-choice { border-color: var(--line); background: #202b33; }
:root[data-theme="dark"] .icon-choice.is-selected { border-color: var(--cyan); background: #17424d; }
:root[data-theme="dark"] .category-manager-emoji { background: #10313a; }
:root[data-theme="dark"] .emoji-choice.is-system-icon { background: #222d33; }
:root[data-theme="dark"] .emoji-choice.is-system-icon:hover,
:root[data-theme="dark"] .emoji-choice.is-system-icon:focus-visible,
:root[data-theme="dark"] .emoji-choice.is-system-icon.is-tooltip-open { background: #28343b; }
:root[data-theme="dark"] .system-icon-help {
  color: #edf4f6;
  border-color: #53616a;
  background: #202b33;
  box-shadow: 0 8px 20px rgba(0,0,0,.3);
}
:root[data-theme="dark"] .category-manager-item.is-drop-target { border-color: var(--cyan); background: #123943; }
:root[data-theme="dark"] .delete-category-preview {
  border-color: #653737;
  background: #2b1d1f;
}
:root[data-theme="dark"] .home-goal-card .reward-mini-button { color: #10171c; background: var(--cyan); }
:root[data-theme="dark"] .home-goal-card .reward-mini-button:disabled { color: #7e8c93; background: #2a353c; }
:root[data-theme="dark"] .goal-change-button {
  color: #82def0;
  border-color: #315f69;
  background: rgba(8,14,18,.42);
}
:root[data-theme="dark"] .goal-change-button:hover { border-color: var(--cyan); background: #12343d; }
:root[data-theme="dark"] .goal-select-button,
:root[data-theme="dark"] .goal-picker-item {
  color: var(--ink);
  border-color: #3b5660;
  background: #111a21;
}
:root[data-theme="dark"] .goal-select-button:hover,
:root[data-theme="dark"] .goal-picker-item:hover,
:root[data-theme="dark"] .goal-picker-item.is-selected { border-color: var(--cyan); background: #12343d; }
:root[data-theme="dark"] .goal-empty-icon,
:root[data-theme="dark"] .goal-picker-icon { background: #3a3321; }
:root[data-theme="dark"] .reward-empty-icon,
:root[data-theme="dark"] .reward-icon { color: #1d2428; }
:root[data-theme="dark"] .reward-card:hover { border-color: #4b626d; box-shadow: 0 16px 34px rgba(0,0,0,.22); }
:root[data-theme="dark"] .reward-card.is-available { border-color: #277a65; }
:root[data-theme="dark"] .reward-repeat-badge,
:root[data-theme="dark"] .reward-repeat-option { background: #253139; }
:root[data-theme="dark"] .reward-repeat-option:has(input:checked) {
  border-color: var(--cyan);
  background: rgba(0,191,227,.12);
}
:root[data-theme="dark"] .sidebar-toggle { border-color: var(--canvas); }

@media (max-width: 820px) {
  :root[data-theme="dark"] .sidebar,
  :root[data-theme="dark"] .app-shell.is-sidebar-collapsed .sidebar {
    color: #a9b6bc;
    border-color: var(--line);
    background: rgba(20,29,36,.96);
    box-shadow: 0 -10px 30px rgba(0,0,0,.28);
  }
  :root[data-theme="dark"] .nav-item:hover { color: #fff; background: #253139; }
  :root[data-theme="dark"] .nav-item.is-active { color: #102027; background: var(--cyan); }
}

@media (max-width: 540px) {
  .modal:has(.icon-picker.is-emoji-picker) {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }
  .modal:has(.icon-picker.is-emoji-picker) form { padding: 20px 16px; }
  .icon-picker.is-emoji-picker {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
  }
  .emoji-choice { font-size: clamp(18px, 6vw, 22px); }
}

@media (max-width: 420px) {
  .actions-toolbar { grid-template-columns: 1fr; }
  .action-card { gap: 8px; padding-inline: 9px; }
  .action-footer { gap: 6px; }
  .action-meta { gap: 8px; font-size: 10px; }
  .action-complete { min-width: 84px; padding-inline: 7px; font-size: 8.5px; }
  .category-manager .modal-heading h2 { font-size: 21px; }
  .category-manager .modal-heading p { font-size: 11px; }
  .category-add-button { width: 100%; justify-content: center; }
  .home-profile-card { grid-template-columns: 52px 1fr; }
  .home-balance {
    position: absolute;
    top: 18px;
    right: 18px;
  }
  .home-balance .coin-medium { width: 28px; height: 28px; }
  .home-balance small { display: none; }
  .home-profile-copy { padding-right: 82px; }
  .home-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .home-stat-card {
    grid-template-columns: 38px 1fr;
    grid-template-rows: auto auto;
    justify-items: start;
    min-height: 84px;
    padding: 12px;
    text-align: left;
  }
  .home-stat-icon { grid-row: 1 / 3; width: 38px; height: 38px; }
  .home-actions-panel .point-badge { display: none; }
}

/* Rewards: complete create, manage and claim flow. */
.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  min-height: 52px;
  margin-bottom: 22px;
  padding: 12px 0;
  background: rgba(247,249,250,.94);
  backdrop-filter: blur(14px);
}
.topbar h1 { font-size: clamp(24px, 2.2vw, 32px); }
.topbar-actions { align-items: center; }

.reward-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.reward-editor-toggle svg,
.reward-toolbar-actions svg,
.reward-editor-actions svg,
.reward-empty svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.reward-editor-toggle.is-active {
  color: #fff;
  border-color: var(--charcoal);
  background: var(--charcoal);
}
.reward-balance-banner {
  min-height: 96px;
  padding: 20px 24px;
  background:
    radial-gradient(circle at 88% 12%, rgba(0,191,227,.18), transparent 30%),
    var(--charcoal);
}
.reward-balance-stats {
  display: flex;
  gap: 28px;
  margin-left: auto;
}
.reward-balance-stats > span {
  color: #aeb7bb;
  font-size: 11px;
}
.reward-balance-stats b {
  display: block;
  margin-bottom: 4px;
  color: #fff;
  font-size: 21px;
}
.reward-view-switch {
  display: inline-flex;
  gap: 5px;
  margin: 0 0 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.reward-view-switch[hidden] { display: none; }
.reward-view-switch button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.reward-view-switch button span {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef2f3;
  font-size: 10px;
}
.reward-view-switch button.is-active {
  color: #fff;
  background: var(--charcoal);
}
.reward-view-switch button.is-active span {
  color: var(--charcoal);
  background: var(--orange);
}
.reward-card {
  display: flex;
  flex-direction: column;
  min-height: 300px;
  padding: 20px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.reward-card:hover {
  transform: translateY(-2px);
  border-color: #cbdde1;
  box-shadow: 0 16px 34px rgba(45,49,52,.1);
}
.reward-card.is-available {
  border-color: #a9dfd2;
  box-shadow: 0 14px 34px rgba(10,168,128,.09);
}
.reward-card.is-archived {
  opacity: .76;
  background: #f3f5f6;
  box-shadow: none;
}
.reward-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.reward-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: #687177;
  background: #eef2f3;
  font-size: 10px;
  font-weight: 800;
}
.reward-card.is-available .reward-status {
  color: #087b5f;
  background: #dff7ef;
}
.reward-card.is-archived .reward-status {
  color: #717a7f;
  background: #e4e8ea;
}
.reward-card h3 { margin-top: 19px; }
.reward-card p {
  min-height: 0;
  margin-bottom: 14px;
}
.reward-repeat-badge {
  display: inline-flex;
  align-self: flex-start;
  margin: 0 0 12px;
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--muted);
  background: #f0f3f4;
  font-size: 10px;
  font-weight: 750;
}
.reward-claimed-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin-top: auto;
  padding: 7px 9px;
  border-radius: 9px;
  color: #087b5f;
  background: #eaf8f4;
  font-size: 10px;
  font-weight: 750;
}
.reward-claimed-note svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}
.reward-card-footer { margin-top: 14px; }
.reward-editor-actions {
  display: flex;
  gap: 7px;
}
.reward-editor-actions button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #697176;
  background: #fff;
  cursor: pointer;
}
.reward-editor-actions button:hover {
  color: var(--cyan-dark);
  border-color: var(--cyan);
}
.reward-editor-actions button:last-child:hover {
  color: var(--danger);
  border-color: var(--danger);
}
.reward-empty {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  min-height: 330px;
  align-content: center;
  border: 1px dashed #cfd8db;
  border-radius: 20px;
  background: rgba(255,255,255,.55);
}
.reward-empty-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 14px;
  border-radius: 18px;
  color: var(--charcoal);
  background: #fff0c9;
}
.reward-empty-icon svg { width: 30px; height: 30px; }
.reward-empty strong { color: var(--ink); font-size: 18px; }
.reward-empty p { max-width: 390px; margin: 8px 0 20px; line-height: 1.5; }

.modal textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px 13px;
  resize: vertical;
  border: 1px solid #d7dfe2;
  border-radius: 13px;
  outline: none;
  background: #fbfcfc;
  font: inherit;
  line-height: 1.45;
}
.modal textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,191,227,.14);
}
.reward-repeat-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.reward-repeat-option {
  position: relative;
  display: flex;
  min-height: 76px;
  padding: 13px;
  border: 1px solid #d7dfe2;
  border-radius: 14px;
  background: #fbfcfc;
  cursor: pointer;
}
.reward-repeat-option:has(input:checked) {
  border-color: var(--cyan);
  background: rgba(0,191,227,.08);
  box-shadow: 0 0 0 2px rgba(0,191,227,.12);
}
.reward-repeat-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.reward-repeat-option span,
.reward-repeat-option b,
.reward-repeat-option small { display: block; }
.reward-repeat-option b { color: var(--ink); font-size: 13px; }
.reward-repeat-option small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.35;
}
@media (max-width: 540px) {
  .reward-repeat-options { grid-template-columns: 1fr; }
  .reward-repeat-option { min-height: 66px; }
}
.claim-reward-preview {
  display: grid;
  grid-template-columns: 68px minmax(0,1fr);
  gap: 16px;
  align-items: center;
}
.claim-reward-preview:has(.reward-icon.has-photo) {
  grid-template-columns: 92px minmax(0,1fr);
}
.claim-reward-preview .reward-icon {
  width: 68px;
  height: 68px;
}
.claim-reward-preview .reward-icon.has-photo {
  width: 92px;
  height: 92px;
}
.claim-reward-preview strong,
.claim-reward-preview span { display: block; }
.claim-reward-preview strong { font-size: 18px; }
.claim-reward-preview span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
@media (max-width: 540px) {
  .confirm-reward-modal {
    width: calc(100vw - 24px);
  }
  .claim-reward-preview {
    grid-template-columns: 68px minmax(0,1fr);
    gap: 12px;
  }
  .claim-reward-preview:has(.reward-icon.has-photo) {
    grid-template-columns: 76px minmax(0,1fr);
  }
  .claim-reward-preview .reward-icon.has-photo {
    width: 76px;
    height: 76px;
    border-radius: 17px;
  }
  .claim-reward-preview strong {
    font-size: 16px;
    line-height: 1.2;
  }
  .claim-reward-preview span {
    font-size: 11px;
    overflow-wrap: anywhere;
  }
}
.claim-balance-preview {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 22px;
  padding: 16px;
  border-radius: 15px;
  background: #f4f7f8;
}
.claim-balance-preview > div { display: grid; gap: 7px; }
.claim-balance-preview > div:last-child { text-align: right; }
.claim-balance-preview div > span {
  color: var(--muted);
  font-size: 10px;
}
.claim-balance-preview strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 20px;
}
.claim-balance-preview > div:last-child strong { justify-content: flex-end; color: var(--green); }
.claim-arrow { color: #9aa3a8; font-size: 20px; }
.claim-confirm-copy {
  margin: 16px 2px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.claim-confirm-copy strong { color: var(--ink); }
.archive-reward-preview {
  display: grid;
  grid-template-columns: 68px minmax(0,1fr);
  gap: 16px;
  align-items: center;
  padding: 17px;
  border-radius: 16px;
  background: #f5f7f8;
}
.archive-reward-preview strong,
.archive-reward-preview span { display: block; }
.archive-reward-preview strong { font-size: 17px; }
.archive-reward-preview span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.archive-confirm-button {
  color: #fff;
  background: var(--danger);
  box-shadow: 0 9px 20px rgba(228,82,63,.2);
}
.reward-card.is-archived .reward-editor-actions button:last-child:hover {
  color: var(--cyan-dark);
  border-color: var(--cyan);
}

@media (max-width: 820px) {
  .topbar {
    min-height: 46px;
    margin-bottom: 14px;
  }
  .reward-toolbar-actions {
    width: 100%;
    justify-content: stretch;
  }
  .reward-toolbar-actions > button { flex: 1 1 190px; }
  .reward-balance-banner { min-height: 88px; }
  .reward-balance-stats { gap: 18px; }
  .reward-card { min-height: 0; }
}

@media (max-width: 540px) {
  .reward-balance-banner {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 11px;
    padding: 17px;
  }
  .reward-balance-banner .coin-medium { width: 42px; height: 42px; }
  .reward-balance-stats {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 8px;
    margin: 4px 0 0;
  }
  .reward-balance-stats > span {
    padding: 10px;
    border-radius: 11px;
    background: rgba(255,255,255,.06);
  }
  .reward-balance-stats b { display: inline; margin-right: 3px; font-size: 15px; }
  .reward-view-switch { display: flex; width: 100%; }
  .reward-view-switch[hidden] { display: none; }
  .reward-view-switch button { flex: 1; justify-content: center; }
  .reward-card { padding: 17px; }
  .claim-balance-preview { padding: 13px; }
  .claim-balance-preview strong { font-size: 17px; }
}

:root[data-theme="dark"] .reward-photo-drop {
  border-color: #41515a;
  background: #182229;
}
:root[data-theme="dark"] .reward-photo-drop:hover {
  border-color: var(--cyan);
  background: #152b32;
}
:root[data-theme="dark"] .reward-photo-placeholder strong { color: var(--ink); }

/* Compact rewards catalog: the top bar already carries the page title and balance. */
#rewardsView .reward-compact-toolbar {
  justify-content: flex-end;
  min-height: 0;
  margin: 0 0 14px;
}
#rewardsView .reward-toolbar-actions {
  flex-wrap: nowrap;
}
#rewardsView .reward-toolbar-actions > button {
  min-height: 40px;
  padding: 0 14px;
}
#rewardsView .reward-view-switch {
  margin-bottom: 12px;
}
#rewardsView .reward-catalog {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
#rewardsView .reward-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 88px;
  padding: 11px 13px;
  overflow: visible;
  border-radius: 14px;
  box-shadow: 0 5px 16px rgba(45,49,52,.07);
}
#rewardsView .reward-card::before {
  width: 5px;
  height: calc(100% - 22px);
  top: 11px;
  right: auto;
  left: -1px;
  border-radius: 0 5px 5px 0;
}
#rewardsView .reward-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(45,49,52,.1);
}
#rewardsView .reward-icon,
#rewardsView .reward-icon.has-photo {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 12px;
  box-shadow: none;
}
#rewardsView .reward-icon .ui-emoji { font-size: 31px; }
#rewardsView .reward-card-main {
  min-width: 0;
}
#rewardsView .reward-card-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
#rewardsView .reward-card h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#rewardsView .reward-status {
  flex: 0 0 auto;
  min-height: 22px;
  padding: 0 8px;
  font-size: 9px;
}
#rewardsView .reward-card p {
  margin: 4px 0 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#rewardsView .reward-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
#rewardsView .reward-card-meta .cost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  padding: 3px 8px;
  border-radius: 8px;
  background: #fff1c8;
  font-size: 12px;
}
#rewardsView .reward-repeat-badge,
#rewardsView .reward-claimed-note {
  min-height: 25px;
  margin: 0;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 9px;
}
#rewardsView .reward-card-footer {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 116px;
  margin: 0;
  padding: 0;
  border: 0;
}
#rewardsView .claim-button {
  min-width: 108px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
}
#rewardsView .reward-empty { min-height: 240px; }

:root[data-theme="dark"] #rewardsView .reward-card-meta .cost {
  color: #f6c44f;
  background: #3b3423;
}

@media (max-width: 640px) {
  #rewardsView .reward-compact-toolbar {
    position: sticky;
    z-index: 20;
    top: 70px;
    padding: 6px 0;
    background: var(--canvas);
  }
  #rewardsView .reward-toolbar-actions {
    width: 100%;
    gap: 7px;
  }
  #rewardsView .reward-toolbar-actions > button {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 8px;
    font-size: 11px;
  }
  #rewardsView .reward-card {
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 78px;
    padding: 10px;
  }
  #rewardsView .reward-icon,
  #rewardsView .reward-icon.has-photo {
    width: 54px;
    height: 54px;
    border-radius: 10px;
  }
  #rewardsView .reward-card-heading { align-items: flex-start; }
  #rewardsView .reward-card h3 { white-space: normal; }
  #rewardsView .reward-card p { display: none; }
  #rewardsView .reward-card-meta { margin-top: 6px; }
  #rewardsView .reward-repeat-badge {
    max-width: 108px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #rewardsView .reward-claimed-note { display: none; }
  #rewardsView .reward-card-footer {
    grid-column: auto;
    min-width: 82px;
  }
  #rewardsView .claim-button {
    width: auto;
    min-width: 82px;
    min-height: 34px;
    padding-inline: 8px;
    font-size: 10px;
  }
  #rewardsView .reward-editor-actions {
    width: auto;
    justify-content: flex-end;
  }
}

@media (max-width: 390px) {
  #rewardsView .reward-card {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px 8px;
  }
  #rewardsView .reward-icon,
  #rewardsView .reward-icon.has-photo {
    width: 48px;
    height: 48px;
  }
  #rewardsView .reward-status { display: none; }
  #rewardsView .reward-repeat-badge { display: none; }
  #rewardsView .reward-card-footer,
  #rewardsView .claim-button { min-width: 74px; }
}

/* Reward categories and denser reward form. */
#rewardModal { width: min(680px, calc(100vw - 28px)); }
#rewardModal form { padding: 20px 22px; }
#rewardModal .modal-heading { margin-bottom: 14px; }
#rewardModal .modal-heading h2 { font-size: 23px; }
#rewardModal label { margin-top: 11px; }
#rewardModal fieldset { margin-top: 11px; }
#rewardModal .modal-actions { margin-top: 16px; }
#rewardModal textarea { min-height: 66px; }
#rewardModal .reward-photo-drop { min-height: 92px; }
#rewardModal .reward-photo-placeholder { grid-template-columns: auto 1fr; justify-items: start; column-gap: 11px; padding: 13px 16px; text-align: left; }
#rewardModal .reward-photo-placeholder b { grid-row: 1 / 3; align-self: center; font-size: 27px; }
#rewardModal .reward-photo-placeholder small { align-self: start; }
#rewardModal .reward-photo-drop img { height: 112px; }
.reward-category-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: 58px;
  gap: 8px;
  margin: 0 0 12px;
  padding: 2px 1px;
  overflow: visible;
}
.reward-category-tabs { margin-bottom: 18px; }
.reward-category-filters[hidden] { display: none; }
.reward-category-filters button {
  position: relative;
  display: grid;
  place-items: center;
  align-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  padding: 5px 24px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #fff;
  font-size: 9px;
  font-weight: 750;
  cursor: pointer;
}
.reward-category-filters button b { font-size: 19px; line-height: 1; }
.reward-category-filters button em {
  max-width: 100%;
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reward-category-filters button span {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: #edf1f2;
  font-size: 8px;
}
.reward-category-filters button.is-active { color: #fff; border-color: var(--charcoal); background: var(--charcoal); }
.reward-category-filters button.is-active span { color: var(--charcoal); background: var(--orange); }
#rewardsView .reward-category-badge {
  min-height: 25px;
  padding: 5px 8px;
  border-radius: 8px;
  color: #3b6570;
  background: #e8f6f9;
  font-size: 9px;
}
.reward-category-field { margin-top: 14px; }
.reward-category-field legend span,
.reward-photo-field legend span { color: var(--muted); font-weight: 500; }
.reward-category-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: 64px;
  gap: 8px;
  max-height: none;
  padding: 2px 3px 3px;
  overflow: visible;
}
.reward-category-choice {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 0;
  padding: 5px 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
}
.reward-category-choice.reward-category-add {
  color: var(--cyan-dark);
  border-style: dashed;
  background: var(--cyan-pale);
}
.reward-category-choice.reward-category-add b { font-size: 26px; font-weight: 400; }
.reward-category-choice:disabled { opacity: .45; cursor: not-allowed; }
.reward-category-choice b { font-size: 21px; line-height: 1; }
.reward-category-choice span {
  max-width: 100%;
  overflow: hidden;
  font-size: 8px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reward-category-choice.is-selected {
  color: var(--ink);
  border-color: var(--cyan);
  background: var(--cyan-pale);
  box-shadow: 0 0 0 2px rgba(0,191,227,.14);
}
.reward-compact-settings {
  display: grid;
  grid-template-columns: minmax(150px, .72fr) minmax(270px, 1.28fr);
  gap: 12px;
  align-items: start;
  margin-top: 14px;
}
.reward-compact-settings > label,
.reward-compact-settings fieldset { margin: 0; }
.reward-repeat-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 4px;
  border-radius: 12px;
  background: #edf1f2;
}
.reward-repeat-switch label { margin: 0; cursor: pointer; }
.reward-repeat-switch input { position: absolute; opacity: 0; pointer-events: none; }
.reward-repeat-switch span {
  display: grid;
  place-items: center;
  min-height: 39px;
  padding: 0 8px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}
.reward-repeat-switch input:checked + span { color: var(--ink); background: #fff; box-shadow: 0 2px 7px rgba(45,49,52,.1); }
:root[data-theme="dark"] .reward-category-filters button { color: var(--muted); border-color: #31444d; background: #18242a; }
:root[data-theme="dark"] .reward-category-filters button.is-active { color: #142027; background: var(--cyan); }
:root[data-theme="dark"] #rewardsView .reward-category-badge { color: #8edceb; background: #19353c; }
:root[data-theme="dark"] .reward-category-choice { border-color: #31444d; background: #18242a; }
:root[data-theme="dark"] .reward-category-choice.is-selected { background: #173a43; }
:root[data-theme="dark"] .reward-category-choice.reward-category-add { color: var(--cyan); background: #173a43; }
:root[data-theme="dark"] .reward-repeat-switch { background: #111b20; }
:root[data-theme="dark"] .reward-repeat-switch input:checked + span { color: #fff; background: #26363e; }

/* Account drawer and settings */
.burger-button {
  display: grid;
  place-content: center;
  gap: 4px;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 3px 3px 0 rgba(45,49,52,.08);
  cursor: pointer;
}
.burger-button span {
  display: block;
  width: 19px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(2,7,15,.72);
  backdrop-filter: blur(2px);
}
.account-drawer {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  width: min(360px, 88vw);
  height: 100dvh;
  color: #f5f7fb;
  background: #050b18;
  box-shadow: -22px 0 50px rgba(0,0,0,.35);
  transform: translateX(105%);
  transition: transform .24s ease;
}
.account-drawer.is-open { transform: translateX(0); }
.drawer-profile {
  position: relative;
  display: grid;
  grid-template-columns: 66px minmax(0,1fr);
  gap: 15px;
  align-items: center;
  min-height: 118px;
  padding: 23px 44px 20px 24px;
  background: #172136;
}
.drawer-avatar {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 3px solid var(--cyan);
  border-radius: 50%;
  color: #252a2d;
  background: var(--orange);
  font-size: 25px;
  font-weight: 900;
}
.drawer-profile-copy strong,
.drawer-profile-copy > span,
.drawer-profile-copy b { display: block; }
.drawer-profile-copy strong { font-size: 17px; line-height: 1.25; }
.drawer-profile-copy > span { margin-top: 3px; color: #a8b4c7; font-size: 12px; }
.drawer-profile-copy b {
  width: fit-content;
  margin-top: 10px;
  padding: 5px 11px;
  border-radius: 99px;
  color: #fff;
  background: linear-gradient(90deg, #2469ff, #923fee);
  font-size: 11px;
}
.drawer-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  color: #c7cfdb;
  background: transparent;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}
.drawer-nav { display: grid; gap: 2px; padding: 17px 14px; }
.drawer-nav button {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-height: 48px;
  padding: 0 13px;
  border: 0;
  border-radius: 11px;
  color: #e4e8f0;
  background: transparent;
  text-align: left;
}
.drawer-nav button > span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: 19px;
}
.drawer-nav button b { font-size: 13px; }
.drawer-nav button em {
  padding: 4px 6px;
  border-radius: 5px;
  color: #18252a;
  background: var(--cyan);
  font-size: 7px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.drawer-nav button:disabled { cursor: default; opacity: .62; }
.drawer-nav button.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(0,191,227,.24), rgba(0,191,227,.06));
  box-shadow: inset 3px 0 0 var(--cyan);
  cursor: pointer;
}
.drawer-nav button.is-active:hover { background-color: rgba(0,191,227,.12); }
body.has-open-drawer { overflow: hidden; }

@media (max-width: 980px) {
  input,
  select,
  textarea,
  [contenteditable="true"] {
    font-size: 16px !important;
  }
}

.settings-page {
  display: grid;
  gap: 15px;
  max-width: 920px;
  margin: 0 auto;
}
.settings-section {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 25px rgba(35,45,50,.045);
}
.settings-section-heading {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr);
  gap: 12px;
  align-items: center;
}
.settings-section-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 19px;
}
.settings-icon-purple { color: #fff; background: #7857f6; }
.settings-icon-blue { color: #fff; background: #18a8ed; }
.settings-icon-green { color: #fff; background: #13c98b; }
.settings-icon-orange { color: #fff; background: #ff6f30; }
.settings-icon-red { color: #fff; background: #e84155; }
.settings-section-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.settings-section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.settings-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-top: 20px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}
.settings-option strong,
.settings-option small { display: block; }
.settings-option strong { font-size: 13px; }
.settings-option small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.settings-language strong { display: flex; align-items: center; gap: 8px; }
.settings-language strong span {
  padding: 4px 8px;
  border-radius: 99px;
  color: #d8dee7;
  background: #273247;
  font-size: 9px;
}
.setting-switch {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 27px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: #c9d0d8;
  cursor: pointer;
  transition: background .18s ease;
}
.setting-switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,.2);
  transition: transform .18s ease;
}
.setting-switch.is-enabled { background: var(--cyan); }
.setting-switch.is-enabled i { transform: translateX(21px); }
.settings-policy-button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 43px;
  margin-top: 20px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
.settings-policy-button:hover { border-color: var(--cyan); }
.settings-danger-section { border-color: #ed334b; }
.settings-danger-section .settings-section-heading h2 { color: #f15a68; }
.settings-danger-warning {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  margin-top: 20px;
  padding: 14px;
  border: 1px solid #a51e31;
  border-radius: 11px;
  color: #ff6f7b;
  background: #310713;
}
.settings-danger-warning strong { font-size: 11px; }
.settings-danger-warning p { margin: 4px 0 0; font-size: 9px; line-height: 1.45; }
.settings-reset-button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #9a2228;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}
.settings-reset-button:hover { background: #b32630; }
.settings-footer {
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 82px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--muted);
  background: var(--surface);
  font-size: 10px;
}
.settings-footer strong { color: var(--cyan-dark); font-size: 11px; }
.reset-progress-confirmation {
  padding: 15px;
  border: 1px solid #f1b2b9;
  border-radius: 12px;
  color: #8f1f2c;
  background: #fff2f4;
}
.reset-progress-confirmation strong { font-size: 12px; line-height: 1.45; }
.reset-progress-confirmation p { margin: 7px 0 0; font-size: 10px; line-height: 1.45; }

:root[data-theme="dark"] .burger-button,
:root[data-theme="dark"] .settings-section,
:root[data-theme="dark"] .settings-footer { background: var(--surface); }
:root[data-theme="dark"] .settings-policy-button { color: var(--ink); }
:root[data-theme="dark"] .reset-progress-confirmation {
  color: #ff8590;
  border-color: #73303a;
  background: #32151a;
}

@media (max-width: 820px) {
  .burger-button { width: 42px; height: 42px; border-radius: 12px; box-shadow: none; }
  .settings-page { gap: 14px; }
  .settings-section { padding: 18px 16px; border-radius: 15px; }
  .settings-section-heading h2 { font-size: 18px; }
  .settings-option { margin-top: 17px; padding-top: 15px; }
}

@media (max-width: 480px) {
  .topbar-actions { gap: 6px; }
  .balance-chip { padding-inline: 9px; }
  .account-drawer { width: 82vw; min-width: 276px; }
  .drawer-profile { grid-template-columns: 56px minmax(0,1fr); min-height: 108px; padding: 20px 42px 18px 18px; }
  .drawer-avatar { width: 54px; height: 54px; }
  .drawer-nav { padding-inline: 10px; }
  .settings-section-heading { grid-template-columns: 36px minmax(0,1fr); }
  .settings-section-icon { width: 36px; height: 36px; }
  .settings-section-heading p { line-height: 1.4; }
  .settings-option { gap: 10px; }
  .settings-option small { max-width: 230px; }
}

@media (max-width: 640px) {
  #rewardsView .reward-category-badge { max-width: 105px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #rewardModal form { padding: 18px 15px; }
  #rewardModal .reward-photo-placeholder small { display: none; }
  .reward-category-picker { grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: 58px; gap: 5px; max-height: none; }
  .reward-category-choice b { font-size: 18px; }
  .reward-category-choice span { font-size: 7px; }
  .reward-category-create-fields { grid-template-columns: 78px minmax(0, 1fr); gap: 8px; }
  .reward-category-filters { grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: 54px; gap: 5px; }
  .reward-category-filters button { padding: 5px 18px 4px 4px; font-size: 7px; }
  .reward-category-filters button b { font-size: 17px; }
  .reward-category-filters button span { top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 3px; font-size: 7px; }
  .reward-compact-settings { grid-template-columns: 1fr; gap: 10px; }
}

/* Statistics */
.statistics-page {
  display: grid;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}
.statistics-heading { margin-bottom: 0; }
.statistics-controls {
  padding: 20px;
  border-radius: 20px;
}
.statistics-period-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  border-radius: 14px;
  background: var(--canvas);
}
.statistics-period-tabs button {
  min-height: 43px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}
.statistics-period-tabs button.is-active {
  color: #102027;
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(31, 45, 51, .1);
}
.statistics-range-nav {
  display: grid;
  grid-template-columns: 40px minmax(160px, auto) 40px;
  justify-content: center;
  align-items: center;
  gap: 13px;
  margin: 18px 0;
}
.statistics-range-nav button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0 0 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--cyan-dark);
  background: var(--surface);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.statistics-range-nav button:disabled { opacity: .35; cursor: default; }
.statistics-range-nav strong { text-align: center; font-size: 15px; }
.statistics-filter-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}
.statistics-filter-heading span { font-size: 12px; font-weight: 850; }
.statistics-filter-heading small { color: var(--muted); font-size: 9px; }
.statistics-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}
.statistics-category-tabs button {
  position: relative;
  display: grid;
  grid-template-columns: 24px auto 20px;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
}
.statistics-category-tabs button > span { font-size: 17px; }
.statistics-category-tabs button b { font-size: 10px; white-space: nowrap; }
.statistics-category-tabs button small {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 7px;
  color: var(--muted);
  background: var(--canvas);
  font-size: 8px;
  font-weight: 900;
}
.statistics-category-tabs button.is-active {
  color: #102027;
  border-color: var(--cyan);
  background: rgba(0, 191, 227, .1);
  box-shadow: inset 3px 0 0 var(--cyan);
}
.statistics-category-tabs button.is-active small { color: #102027; background: var(--cyan); }

.statistics-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.statistics-summary article {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(35, 45, 50, .045);
}
.statistics-summary-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}
.statistics-summary-icon.tone-cyan { color: #102027; background: var(--cyan); }
.statistics-summary-icon.tone-orange { color: #332000; background: var(--orange); }
.statistics-summary-icon.tone-green { background: #16b58e; }
.statistics-summary-icon.tone-purple { background: #7857f6; }
.statistics-summary strong,
.statistics-summary small { display: block; }
.statistics-summary strong { font-size: 21px; line-height: 1; }
.statistics-summary small { margin-top: 5px; color: var(--muted); font-size: 9px; }

.statistics-content { min-width: 0; }
.statistics-week-card {
  padding: 7px;
  overflow: hidden;
  border-radius: 20px;
}
.statistics-week-scroll { overflow-x: auto; }
.statistics-week-grid {
  display: grid;
  grid-template-columns: minmax(210px, 1.8fr) repeat(7, minmax(42px, .55fr)) 72px;
  align-items: stretch;
  min-width: 690px;
}
.statistics-week-header {
  min-height: 50px;
  color: var(--muted);
  background: var(--canvas);
}
.statistics-week-header > span {
  display: grid;
  place-items: center;
  padding: 7px;
  border-right: 1px solid var(--line);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}
.statistics-week-header > span:first-child { place-items: center start; padding-left: 15px; }
.statistics-week-header > span:last-child { border-right: 0; }
.statistics-week-header small { margin-top: 2px; font-size: 8px; }
.statistics-week-header .is-today { color: #172024; background: rgba(252, 170, 7, .24); }
.statistics-week-row {
  min-height: 68px;
  border-bottom: 1px solid var(--line);
}
.statistics-week-row:last-child { border-bottom: 0; }
.statistics-habit-name {
  display: grid;
  grid-template-columns: 37px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 10px;
  border-right: 1px solid var(--line);
}
.statistics-habit-name > span {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border-radius: 11px;
  background: var(--stat-soft, rgba(0, 191, 227, .12));
  font-size: 19px;
}
.statistics-habit-name strong,
.statistics-habit-name small { display: block; }
.statistics-habit-name strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.statistics-habit-name small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.statistics-day-cell {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #102027;
  background: var(--canvas);
  font-size: 12px;
  font-weight: 950;
}
.statistics-day-cell.is-done { border-color: var(--stat-accent, var(--cyan)); background: var(--stat-accent, var(--cyan)); }
.statistics-day-cell.is-off { border-style: dashed; opacity: .36; }
.statistics-day-cell.is-future { opacity: .18; }
.statistics-row-rate {
  display: grid;
  place-items: center;
  border-left: 1px solid var(--line);
  color: var(--stat-accent, var(--cyan-dark));
  font-size: 12px;
}

.tone-cyan { --stat-accent: #00bfe3; --stat-soft: rgba(0, 191, 227, .13); }
.tone-purple { --stat-accent: #7857f6; --stat-soft: rgba(120, 87, 246, .13); }
.tone-orange { --stat-accent: #fcaa07; --stat-soft: rgba(252, 170, 7, .15); }
.tone-green { --stat-accent: #16b58e; --stat-soft: rgba(22, 181, 142, .13); }
.tone-blue { --stat-accent: #3286ed; --stat-soft: rgba(50, 134, 237, .13); }

.statistics-month-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.statistics-calendar-card,
.statistics-year-card {
  padding: 18px;
  overflow: hidden;
  border-radius: 19px;
}
.statistics-calendar-card header,
.statistics-year-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: -18px -18px 15px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--stat-soft);
}
.statistics-calendar-card header > div,
.statistics-year-card header > div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
}
.statistics-calendar-card header > div > span,
.statistics-year-card header > div > span { font-size: 21px; }
.statistics-calendar-card header strong,
.statistics-calendar-card header small,
.statistics-year-card header strong,
.statistics-year-card header small { display: block; }
.statistics-calendar-card header strong,
.statistics-year-card header strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.statistics-calendar-card header small,
.statistics-year-card header small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.statistics-calendar-card header > b,
.statistics-year-card header > b { color: var(--stat-accent); font-size: 18px; }
.statistics-calendar-weekdays,
.statistics-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.statistics-calendar-weekdays { margin-bottom: 6px; }
.statistics-calendar-weekdays span { color: var(--muted); font-size: 8px; font-weight: 850; text-align: center; }
.statistics-calendar-days i {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--canvas);
  font-style: normal;
}
.statistics-calendar-days i > span { font-size: 8px; }
.statistics-calendar-days i > b {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font-size: 8px;
}
.statistics-calendar-days i.is-done {
  color: #102027;
  border-color: var(--stat-accent);
  background: var(--stat-accent);
}
.statistics-calendar-days i.is-off { opacity: .33; }
.statistics-calendar-days i.is-future { opacity: .16; }
.statistics-calendar-card footer,
.statistics-year-card footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 8px;
}
.statistics-calendar-card footer b,
.statistics-year-card footer b { color: var(--stat-accent); font-size: 11px; }

.statistics-year-list { display: grid; gap: 14px; }
.statistics-year-months {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 7px;
  text-transform: uppercase;
}
.statistics-year-months span { text-align: center; }
.statistics-year-heatmap {
  display: grid;
  grid-template-columns: repeat(var(--statistics-weeks), minmax(3px, 1fr));
  grid-template-rows: repeat(7, minmax(3px, 1fr));
  grid-auto-flow: column;
  gap: 3px;
}
.statistics-year-heatmap i {
  display: block;
  min-width: 0;
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--canvas);
}
.statistics-year-heatmap i.is-done { background: var(--stat-accent); }
.statistics-year-heatmap i.is-off { opacity: .35; }
.statistics-year-heatmap i.is-future { opacity: .12; }
.statistics-year-heatmap i.is-empty { visibility: hidden; }
.statistics-empty {
  display: grid;
  place-items: center;
  min-height: 250px;
  padding: 30px;
  border-radius: 20px;
  text-align: center;
}
.statistics-empty > span { color: var(--cyan); font-size: 35px; }
.statistics-empty strong { margin-top: 10px; font-size: 16px; }
.statistics-empty p { margin: 7px 0 0; color: var(--muted); font-size: 10px; }

:root[data-theme="dark"] .statistics-period-tabs button.is-active,
:root[data-theme="dark"] .statistics-range-nav button,
:root[data-theme="dark"] .statistics-category-tabs button,
:root[data-theme="dark"] .statistics-summary article,
:root[data-theme="dark"] .statistics-week-card,
:root[data-theme="dark"] .statistics-calendar-card,
:root[data-theme="dark"] .statistics-year-card,
:root[data-theme="dark"] .statistics-empty { background: var(--surface); }
:root[data-theme="dark"] .statistics-period-tabs button.is-active,
:root[data-theme="dark"] .statistics-category-tabs button.is-active,
:root[data-theme="dark"] .statistics-day-cell.is-done,
:root[data-theme="dark"] .statistics-calendar-days i.is-done { color: #102027; }

@media (max-width: 900px) {
  .statistics-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statistics-month-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
  .statistics-page { gap: 12px; }
  .statistics-heading h2 { font-size: 25px; }
  .statistics-heading p { font-size: 11px; line-height: 1.45; }
  .statistics-controls { padding: 14px; border-radius: 17px; }
  .statistics-period-tabs button { min-height: 39px; padding-inline: 8px; font-size: 10px; }
  .statistics-range-nav { grid-template-columns: 36px minmax(150px, 1fr) 36px; gap: 7px; margin-block: 14px; }
  .statistics-range-nav button { width: 36px; height: 36px; }
  .statistics-range-nav strong { font-size: 12px; }
  .statistics-filter-heading small { display: none; }
  .statistics-category-tabs {
    flex-wrap: nowrap;
    margin-inline: -14px;
    padding: 0 14px 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .statistics-category-tabs::-webkit-scrollbar { display: none; }
  .statistics-category-tabs button { flex: 0 0 auto; }
  .statistics-summary { gap: 7px; }
  .statistics-summary article { grid-template-columns: 34px minmax(0, 1fr); gap: 8px; min-height: 66px; padding: 10px; border-radius: 14px; }
  .statistics-summary-icon { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
  .statistics-summary strong { font-size: 17px; }
  .statistics-summary small { font-size: 8px; }
  .statistics-week-card { margin-inline: -4px; }
  .statistics-calendar-card,
  .statistics-year-card { padding: 14px; border-radius: 16px; }
  .statistics-calendar-card header,
  .statistics-year-card header { margin: -14px -14px 12px; padding: 12px 14px; }
  .statistics-calendar-days { gap: 5px; }
  .statistics-calendar-days i { border-radius: 7px; }
  .statistics-year-heatmap { gap: 2px; }
  .statistics-year-months { font-size: 6px; }
}

/* Theme and mobile hardening for every screen added after the base theme. */
:root[data-theme="dark"] {
  --cyan-dark: #58d8ed;
}

:root[data-theme="dark"] :where(
  .profile-settings-card,
  .profile-stat,
  .profile-account-card,
  .settings-section,
  .settings-footer,
  .statistics-controls,
  .statistics-summary article,
  .statistics-week-card,
  .statistics-calendar-card,
  .statistics-year-card,
  .statistics-empty
) {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}

:root[data-theme="dark"] .profile-stat-streak .profile-stat-icon { color: #f3a36c; background: #3a241b; }
:root[data-theme="dark"] .profile-stat-actions .profile-stat-icon { color: #67dab8; background: #16382e; }
:root[data-theme="dark"] .profile-stat-rewards .profile-stat-icon { color: #d89add; background: #3a213d; }
:root[data-theme="dark"] .profile-stat-team .profile-stat-icon { color: #85bdf2; background: #1b3045; }
:root[data-theme="dark"] .profile-account-actions .is-danger .profile-account-icon { color: #ef8e8e; background: #3a2022; }
:root[data-theme="dark"] .profile-account-actions .is-danger strong { color: #ef9b9b; }

:root[data-theme="dark"] :where(
  .topbar h1,
  .section-toolbar h2,
  .panel-heading h2,
  .settings-section-heading h2,
  .settings-option strong,
  .statistics-range-nav strong,
  .statistics-summary strong,
  .statistics-habit-name strong,
  .statistics-calendar-card header strong,
  .statistics-year-card header strong,
  .statistics-empty strong
) {
  color: var(--ink);
}

:root[data-theme="dark"] :where(
  .modal label,
  .modal legend,
  .action-meta
) {
  color: var(--muted);
}

:root[data-theme="dark"] .icon-button {
  color: var(--muted);
  background: #24313a;
}

:root[data-theme="dark"] .primary-button,
:root[data-theme="dark"] .primary-button.orange {
  color: #071013;
}

:root[data-theme="dark"] .statistics-period-tabs {
  background: #101820;
}

:root[data-theme="dark"] .statistics-period-tabs button {
  color: var(--muted);
}

:root[data-theme="dark"] .statistics-period-tabs button.is-active {
  color: #071013;
  background: var(--cyan);
  box-shadow: 0 6px 18px rgba(0, 191, 227, .2);
}

:root[data-theme="dark"] .statistics-range-nav button {
  color: var(--cyan);
  border-color: var(--line);
  background: #202b33;
}

:root[data-theme="dark"] .statistics-category-tabs button {
  color: var(--muted);
  border-color: var(--line);
  background: #202b33;
}

:root[data-theme="dark"] .statistics-category-tabs button small {
  color: var(--muted);
  background: #101820;
}

:root[data-theme="dark"] .statistics-category-tabs button.is-active {
  color: #071013;
  border-color: var(--cyan);
  background: var(--cyan);
  box-shadow: 0 6px 18px rgba(0, 191, 227, .16);
}

:root[data-theme="dark"] .statistics-category-tabs button.is-active small {
  color: #071013;
  background: rgba(255, 255, 255, .58);
}

:root[data-theme="dark"] .statistics-week-header .is-today {
  color: #2a1b00;
  background: rgba(252, 170, 7, .72);
}

:root[data-theme="dark"] .statistics-day-cell:not(.is-done),
:root[data-theme="dark"] .statistics-calendar-days i:not(.is-done),
:root[data-theme="dark"] .statistics-year-heatmap i:not(.is-done) {
  color: var(--muted);
  background: #101820;
}

.statistics-view,
.statistics-page,
.statistics-controls,
.statistics-summary,
.statistics-content,
.statistics-week-card,
.statistics-week-scroll,
.statistics-month-grid,
.statistics-year-list,
.statistics-calendar-card,
.statistics-year-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.statistics-category-tabs {
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 540px) {
  .statistics-view {
    overflow-x: clip;
  }

  .statistics-controls {
    overflow: hidden;
  }

  .statistics-category-tabs {
    width: calc(100% + 28px);
    max-width: none;
  }

  .statistics-summary article {
    min-width: 0;
  }

  .statistics-summary strong,
  .statistics-summary small {
    overflow-wrap: anywhere;
  }

  .statistics-week-scroll {
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .statistics-year-card {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .statistics-year-months,
  .statistics-year-heatmap {
    min-width: 0;
  }
}

/* Statistics compact layout — v0.4.2 */
.statistics-page {
  gap: 12px;
}

.statistics-category-tabs.category-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(56px, 72px));
  gap: 9px;
  width: fit-content;
  max-width: 100%;
  max-height: 232px;
  margin: 12px 0 0;
  padding: 2px 6px 6px 2px;
  overflow-x: hidden;
  overflow-y: auto;
}

.statistics-category-tabs.category-tabs .category-tab {
  display: grid;
  grid-template-columns: none;
  place-items: center;
  width: 72px;
  min-height: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: none;
}

.statistics-category-tabs.category-tabs .category-tab.is-active {
  color: var(--ink);
  border-color: var(--cyan);
  background: var(--cyan-pale);
  box-shadow: 0 0 0 3px rgba(0, 191, 227, .1);
}

.statistics-year-card footer {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.statistics-year-card footer b {
  font-size: 14px;
}

/* Statistics refinements — v0.4.3 */
.statistics-year-card {
  padding: 10px 14px;
}

.statistics-year-card header {
  min-height: 34px;
  margin: -10px -14px 7px;
  padding: 5px 10px;
}

.statistics-year-card header > div {
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 6px;
}

.statistics-year-card header > div > span {
  font-size: 16px;
}

.statistics-year-card header strong {
  font-size: 10px;
}

.statistics-year-card header small {
  margin-top: 1px;
  font-size: 6px;
}

.statistics-year-card header > b {
  font-size: 14px;
}

.statistics-year-card footer {
  margin-top: 6px;
  padding-top: 5px;
  font-size: 9px;
}

.statistics-year-card footer b {
  font-size: 11px;
}

:root[data-theme="dark"] .statistics-category-tabs.category-tabs .category-tab {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}

:root[data-theme="dark"] .statistics-category-tabs.category-tabs .category-tab.is-active {
  color: var(--ink);
  border-color: var(--cyan);
  background: #123943;
  box-shadow: 0 0 0 3px rgba(0,191,227,.1);
}

@media (max-width: 540px) {
  .statistics-controls {
    padding: 10px;
  }

  .statistics-period-tabs {
    padding: 4px;
  }

  .statistics-period-tabs button {
    min-height: 36px;
  }

  .statistics-range-nav {
    grid-template-columns: 34px minmax(120px, 1fr) 34px;
    margin: 10px 0;
  }

  .statistics-range-nav button {
    width: 34px;
    height: 34px;
  }

  .statistics-filter-heading {
    padding-top: 10px;
  }

  .statistics-category-tabs.category-tabs {
    grid-template-columns: repeat(5, minmax(46px, 1fr));
    width: 100%;
    max-height: 196px;
    margin: 8px 0 0;
    padding: 2px 3px 4px 2px;
    gap: 6px;
    overflow-x: hidden;
  }

  .statistics-category-tabs.category-tabs .category-tab {
    width: 100%;
    max-width: 62px;
    border-radius: 14px;
  }

  .statistics-category-tabs.category-tabs .category-emoji {
    font-size: 25px;
  }

  .statistics-week-card {
    margin-inline: 0;
    padding: 4px;
    border-radius: 15px;
  }

  .statistics-week-scroll {
    overflow-x: hidden;
  }

  .statistics-week-grid {
    grid-template-columns: minmax(84px, 1.45fr) repeat(7, minmax(24px, .42fr)) 38px;
    min-width: 0;
  }

  .statistics-week-header {
    min-height: 37px;
  }

  .statistics-week-header > span {
    padding: 3px 1px;
    font-size: 7px;
  }

  .statistics-week-header > span:first-child {
    padding-left: 7px;
  }

  .statistics-week-header small {
    font-size: 7px;
  }

  .statistics-week-row {
    min-height: 47px;
  }

  .statistics-habit-name {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 5px;
    padding: 5px;
  }

  .statistics-habit-name > span {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    font-size: 14px;
  }

  .statistics-habit-name strong {
    max-width: 100%;
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .statistics-habit-name small {
    display: none;
  }

  .statistics-day-cell {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    font-size: 10px;
  }

  .statistics-row-rate {
    font-size: 9px;
  }

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

  .statistics-calendar-card {
    padding: 8px;
    border-radius: 13px;
  }

  .statistics-calendar-card header {
    gap: 4px;
    margin: -8px -8px 7px;
    padding: 7px 8px;
  }

  .statistics-calendar-card header > div {
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 4px;
  }

  .statistics-calendar-card header > div > span {
    font-size: 15px;
  }

  .statistics-calendar-card header strong {
    font-size: 8px;
  }

  .statistics-calendar-card header small {
    display: none;
  }

  .statistics-calendar-card header > b {
    font-size: 11px;
  }

  .statistics-calendar-weekdays,
  .statistics-calendar-days {
    gap: 3px;
  }

  .statistics-calendar-weekdays {
    margin-bottom: 3px;
  }

  .statistics-calendar-weekdays span,
  .statistics-calendar-days i > span,
  .statistics-calendar-days i > b {
    font-size: 6px;
  }

  .statistics-calendar-days i {
    border-radius: 5px;
  }

  .statistics-calendar-card footer {
    gap: 4px;
    margin-top: 7px;
    padding-top: 6px;
    font-size: 6px;
    white-space: nowrap;
  }

  .statistics-calendar-card footer b {
    font-size: 8px;
  }

  .statistics-year-card footer {
    margin-top: 5px;
    padding-top: 4px;
    font-size: 8px;
  }

  .statistics-year-card footer b {
    font-size: 10px;
  }
}

/* Achivo admin and preset catalog */
.drawer-admin-link { position: relative; margin-top: 8px; border-top: 1px solid rgba(255,255,255,.08) !important; }
.drawer-nav .drawer-admin-link > span { color: var(--charcoal); background: var(--orange); font: 900 12px/1 "Press Start 2P", ui-monospace, monospace; }
.drawer-admin-link em { margin-left: auto; padding: 4px 6px; color: #402800; border-radius: 5px; background: var(--orange); font-size: 7px; font-style: normal; letter-spacing: .08em; }

.admin-shell { display: grid; grid-template-columns: 226px minmax(0,1fr); gap: 18px; min-height: 660px; }
.admin-sidebar { display: flex; flex-direction: column; align-self: start; min-height: 640px; padding: 16px; border-radius: 22px; }
.admin-sidebar-heading { display: flex; align-items: center; gap: 11px; padding: 7px 6px 18px; border-bottom: 1px solid var(--line); }
.admin-mark { display: grid; place-items: center; width: 38px; height: 38px; color: var(--charcoal); background: var(--cyan); border: 2px solid var(--charcoal); box-shadow: 3px 3px 0 var(--orange); font: 900 15px/1 "Press Start 2P", ui-monospace, monospace; }
.admin-sidebar-heading strong, .admin-sidebar-heading small { display: block; }
.admin-sidebar-heading strong { font: 900 9px/1.35 "Press Start 2P", ui-monospace, monospace; }
.admin-sidebar-heading small { margin-top: 5px; color: var(--muted); font-size: 9px; }
.admin-nav { display: grid; gap: 5px; padding-top: 16px; }
.admin-nav button { display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 9px; align-items: center; min-height: 46px; padding: 0 11px; border: 0; border-radius: 11px; color: var(--muted); background: transparent; text-align: left; cursor: pointer; }
.admin-nav button > span { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: color-mix(in srgb, var(--line) 55%, transparent); font-size: 15px; }
.admin-nav button b { font-size: 11px; }
.admin-nav button:hover { color: var(--ink); background: color-mix(in srgb, var(--cyan) 8%, var(--surface)); }
.admin-nav button.is-active { color: #102027; background: var(--cyan); box-shadow: 3px 3px 0 var(--charcoal); }
.admin-nav button.is-active > span { background: rgba(255,255,255,.48); }
.admin-exit { display: flex; align-items: center; gap: 8px; min-height: 42px; margin-top: auto; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; }
.admin-exit:hover { color: var(--ink); border-color: var(--cyan); }
.admin-workspace { min-width: 0; }
.admin-panel { display: none; animation: view-in .2s ease both; }
.admin-panel.is-active { display: block; }
.admin-page-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 4px 0 22px; }
.admin-page-heading h2 { margin: 0; font-size: clamp(25px,3vw,36px); letter-spacing: -.04em; }
.admin-page-heading p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.admin-live { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--green) 35%, var(--line)); border-radius: 999px; color: var(--green); background: color-mix(in srgb, var(--green) 8%, var(--surface)); font-size: 10px; font-weight: 900; white-space: nowrap; }
.admin-live i, .admin-status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 15%, transparent); }
.admin-kpi-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 11px; }
.admin-kpi-card { display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 11px; align-items: center; min-height: 112px; padding: 16px; border-radius: 17px; overflow: hidden; }
.admin-kpi-card > span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; color: #102027; background: var(--stat-accent); font-size: 20px; font-weight: 900; }
.admin-kpi-card strong, .admin-kpi-card b, .admin-kpi-card small { display: block; }
.admin-kpi-card strong { font-size: 24px; line-height: 1; }
.admin-kpi-card b { margin-top: 6px; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.admin-kpi-card small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.admin-kpi-card.tone-cyan { --stat-accent: var(--cyan); }
.admin-kpi-card.tone-green { --stat-accent: #37cea6; }
.admin-kpi-card.tone-orange { --stat-accent: var(--orange); }
.admin-kpi-card.tone-purple { --stat-accent: #9c83ff; }
.admin-overview-grid { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(320px,.8fr); gap: 13px; margin-top: 13px; }
.admin-chart-card, .admin-events-card { min-height: 344px; padding: 20px; border-radius: 18px; }
.admin-card-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.admin-card-heading h3 { margin: 0; font-size: 18px; }
.admin-card-heading > strong { color: var(--green); font-size: 13px; }
.admin-card-heading > b { display: grid; place-items: center; min-width: 31px; height: 31px; border-radius: 9px; background: color-mix(in srgb, var(--cyan) 12%, var(--surface)); font-size: 11px; }
.admin-bar-chart { display: grid; grid-template-columns: repeat(7,1fr); gap: 12px; align-items: end; height: 245px; padding-top: 30px; border-bottom: 1px solid var(--line); }
.admin-bar-chart > div { display: grid; grid-template-rows: 1fr 18px; justify-items: center; align-items: end; height: 100%; }
.admin-bar-chart i { position: relative; display: block; width: min(34px,72%); min-height: 8px; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg,var(--cyan),#067e95); transition: height .3s ease; }
.admin-bar-chart i b { position: absolute; top: -19px; left: 50%; color: var(--muted); font-size: 8px; font-style: normal; transform: translateX(-50%); }
.admin-bar-chart span { color: var(--muted); font-size: 8px; font-weight: 800; }
.admin-event-list { display: grid; margin-top: 12px; }
.admin-event-list article { display: grid; grid-template-columns: 46px minmax(0,1fr) auto; gap: 10px; align-items: center; min-height: 60px; border-bottom: 1px solid var(--line); }
.admin-event-list article > span { font-size: 13px; font-weight: 950; }
.admin-event-list strong, .admin-event-list small { display: block; }
.admin-event-list strong { font-size: 11px; }
.admin-event-list small { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.admin-event-list time { color: var(--muted); font-size: 8px; }

.admin-filterbar { display: grid; grid-template-columns: minmax(240px,1fr) 190px auto; gap: 10px; align-items: center; margin-bottom: 12px; padding: 12px; border-radius: 15px; }
.admin-search { display: grid; grid-template-columns: 28px minmax(0,1fr); align-items: center; min-height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface); }
.admin-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; }
.admin-filterbar select { min-height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); }
.admin-filterbar > strong { color: var(--muted); font-size: 9px; white-space: nowrap; }
.admin-table-wrap { overflow-x: auto; border-radius: 17px; }
.admin-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.admin-table th { height: 42px; padding: 0 14px; color: var(--muted); background: color-mix(in srgb, var(--canvas) 70%, var(--surface)); font-size: 8px; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
.admin-table td { height: 68px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 10px; }
.admin-table td > strong, .admin-table td > small { display: block; }
.admin-table td > small { margin-top: 5px; color: var(--muted); font-size: 8px; }
.admin-user-cell { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 10px; align-items: center; }
.admin-user-cell > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #102027; background: var(--cyan); font-weight: 950; }
.admin-user-cell strong, .admin-user-cell small { display: block; }
.admin-user-cell strong { font-size: 11px; }
.admin-user-cell small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.admin-chiv-value { display: inline-flex; align-items: center; gap: 6px; font-weight: 950; }
.admin-status { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 9px; border: 1px solid currentColor; border-radius: 9px; background: transparent; font-size: 8px; font-weight: 900; white-space: nowrap; cursor: pointer; }
.admin-status.is-active { color: var(--green); }
.admin-status.is-blocked { color: var(--danger); }
.admin-status.is-draft { color: #9a7626; }
.admin-status.is-readonly { cursor: default; opacity: .82; }
.admin-user-actions { display: flex; align-items: center; gap: 6px; }
.admin-row-action { display: grid; place-items: center; width: 31px; height: 31px; padding: 0; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); font-weight: 900; cursor: pointer; }
.admin-row-action:hover { border-color: var(--cyan); background: var(--cyan-pale); }
.admin-row-action.is-danger:hover { color: var(--danger); border-color: var(--danger); background: color-mix(in srgb,var(--danger) 8%,var(--surface)); }

.admin-preset-layout { display: grid; grid-template-columns: 245px minmax(0,1fr); gap: 13px; }
.admin-preset-categories, .admin-preset-actions { padding: 17px; border-radius: 18px; }
.admin-preset-category-list { display: grid; gap: 5px; margin-top: 15px; }
.admin-preset-category-list article { display: grid; grid-template-columns: minmax(0,1fr) 28px; align-items: center; border-radius: 11px; }
.admin-preset-category-list article.is-active { color: #102027; background: var(--cyan); box-shadow: 3px 3px 0 var(--charcoal); }
.admin-preset-category-main { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 9px; align-items: center; min-height: 49px; padding: 0 8px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.admin-preset-category-main > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: color-mix(in srgb,var(--line) 60%,transparent); font-size: 17px; }
.admin-preset-category-main strong, .admin-preset-category-main small { display: block; }
.admin-preset-category-main strong { font-size: 10px; }
.admin-preset-category-main small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.admin-preset-category-list article.is-active small { color: #315058; }
.admin-mini-action { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.admin-preset-category-list article.is-active .admin-mini-action:hover { background: rgba(255,255,255,.45); }
.admin-preset-toolbar { display: grid; grid-template-columns: minmax(200px,1fr) auto; gap: 10px; align-items: center; margin: 14px 0 10px; }
.admin-preset-toolbar > span { color: var(--muted); font-size: 8px; }
.admin-preset-action-list { display: grid; gap: 7px; }
.admin-preset-row { display: grid; grid-template-columns: 42px minmax(150px,1fr) 130px 90px 31px 31px; gap: 9px; align-items: center; min-height: 64px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.admin-preset-row.is-draft { opacity: .7; }
.admin-preset-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--cyan-pale); font-size: 20px; }
.admin-preset-copy strong, .admin-preset-copy small { display: block; }
.admin-preset-copy strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.admin-preset-copy small { margin-top: 5px; color: var(--muted); font-size: 8px; }
.admin-preset-chivs { display: inline-flex; align-items: center; gap: 5px; color: #8c5900; font-size: 9px; font-weight: 950; white-space: nowrap; }
.admin-operation-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 11px; margin-bottom: 12px; }
.admin-operation-summary article { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 11px; align-items: center; min-height: 82px; padding: 14px; border-radius: 16px; }
.admin-operation-summary article > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: color-mix(in srgb,var(--cyan) 10%,var(--surface)); font-size: 20px; font-weight: 950; }
.admin-operation-summary strong, .admin-operation-summary small { display: block; }
.admin-operation-summary strong { font-size: 20px; }
.admin-operation-summary small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.admin-operation-amount { font-weight: 950; white-space: nowrap; }
.admin-author { display: inline-flex; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb,var(--cyan) 9%,var(--surface)); font-size: 8px; font-weight: 900; }

.preset-import-modal { width: min(920px,calc(100vw - 28px)); max-height: min(820px,calc(100vh - 28px)); border: 0; border-radius: 22px; box-shadow: 0 28px 80px rgba(8,18,24,.34); }
.preset-import-modal form { padding: 24px; }
.preset-import-modal .modal-heading p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.preset-import-categories {
  display: grid;
  grid-template-columns: repeat(5, minmax(54px, 72px));
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 14px;
  padding: 2px;
}
.preset-import-categories button {
  display: grid;
  place-items: center;
  width: 68px;
  max-width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 16px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  transition: .18s ease;
}
.preset-import-categories button:hover { transform: translateY(-2px); border-color: #aae5ef; }
.preset-import-categories button span { font-size: 29px; line-height: 1; }
.preset-import-categories button.is-active {
  color: var(--ink);
  border-color: var(--cyan);
  background: var(--cyan-pale);
  box-shadow: 0 0 0 3px rgba(0,191,227,.1);
}
.preset-import-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; max-height: 470px; padding: 2px; overflow-y: auto; }
.preset-import-list article { display: grid; grid-template-columns: 26px 42px minmax(0,1fr) 102px; gap: 9px; align-items: center; min-height: 77px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: .15s ease; }
.preset-import-list article.is-selected { border-color: var(--cyan); background: color-mix(in srgb,var(--cyan) 6%,var(--surface)); box-shadow: 0 0 0 2px color-mix(in srgb,var(--cyan) 12%,transparent); }
.preset-import-list article.is-added { opacity: .58; }
.preset-import-check input { position: absolute; opacity: 0; pointer-events: none; }
.preset-import-check i { display: grid; place-items: center; width: 23px; height: 23px; border: 2px solid var(--line); border-radius: 7px; cursor: pointer; }
.preset-import-check input:checked + i { border-color: var(--charcoal); background: var(--cyan); box-shadow: 2px 2px 0 var(--charcoal); }
.preset-import-check input:checked + i::after { content: "✓"; color: #102027; font-size: 12px; font-weight: 950; }
.preset-import-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--cyan-pale); font-size: 21px; }
.preset-import-list article > div strong, .preset-import-list article > div small { display: block; }
.preset-import-list article > div strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.preset-import-list article > div small { margin-top: 5px; color: var(--muted); font-size: 8px; }
.preset-chiv-input { display: grid !important; gap: 4px !important; margin: 0 !important; }
.preset-chiv-input > span { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 7px; }
.preset-chiv-input input { height: 34px !important; margin: 0; padding-inline: 8px !important; border-radius: 9px !important; font-weight: 900; }
.preset-added-badge { padding: 6px 7px; border-radius: 8px; color: var(--green); background: color-mix(in srgb,var(--green) 9%,var(--surface)); font-size: 7px; text-align: center; }
.preset-import-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.preset-import-footer > span { color: var(--muted); font-size: 10px; font-weight: 900; }
.preset-import-footer .modal-actions { margin: 0; }
.admin-inline-fields { display: grid; grid-template-columns: 90px minmax(0,1fr); gap: 11px; }
.admin-form-modal textarea { width: 100%; padding: 12px; border: 2px solid #cfd5d8; color: var(--ink); background: var(--surface); font: inherit; resize: vertical; }
.admin-audit-note { display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 8px; align-items: center; margin-top: 15px; padding: 10px; border: 1px solid color-mix(in srgb,var(--cyan) 28%,var(--line)); border-radius: 11px; background: color-mix(in srgb,var(--cyan) 6%,var(--surface)); }
.admin-audit-note p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.admin-owner-badge { display: inline-flex; align-items: center; gap: 5px; padding: 9px 12px; border: 1px solid color-mix(in srgb,var(--orange) 45%,var(--line)); border-radius: 999px; color: var(--muted); background: color-mix(in srgb,var(--orange) 9%,var(--surface)); font-size: 9px; white-space: nowrap; }
.admin-owner-badge b { color: var(--ink); }
.admin-access-note { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 10px; align-items: center; margin-bottom: 12px; padding: 13px 15px; border-radius: 15px; }
.admin-access-note > span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--cyan-pale); }
.admin-access-note p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.admin-access-table { min-width: 920px; }
.admin-role-badge { display: inline-flex; min-height: 29px; align-items: center; padding: 0 9px; border-radius: 9px; font-size: 8px; font-weight: 900; white-space: nowrap; }
.admin-role-badge.is-owner { color: #7d5600; background: #fff0bd; }
.admin-role-badge.is-admin { color: #08758b; background: var(--cyan-pale); }
.admin-role-badge.is-user { color: var(--muted); background: color-mix(in srgb,var(--line) 55%,transparent); }
.admin-permission-summary { display: block; max-width: 330px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.admin-access-locked { color: var(--muted); font-size: 8px; font-weight: 850; }
.admin-access-edit { min-height: 34px; padding-inline: 11px; font-size: 8px; white-space: nowrap; }
.admin-access-modal { width: min(680px,calc(100vw - 28px)); }
.admin-access-modal .modal-heading p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.admin-access-modal > form > label { display: grid; gap: 8px; color: var(--muted); font-size: 10px; font-weight: 850; }
.admin-access-modal select { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--surface); }
.admin-permission-fieldset { padding: 0; margin: 18px 0 0; border: 0; }
.admin-permission-fieldset legend { margin-bottom: 10px; color: var(--muted); font-size: 10px; font-weight: 850; }
.admin-permission-fieldset.is-disabled { opacity: .45; }
.admin-permission-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.admin-permission-grid label { display: grid; grid-template-columns: 20px minmax(0,1fr); gap: 9px; align-items: center; min-height: 55px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb,var(--cyan) 4%,var(--surface)); cursor: pointer; }
.admin-permission-grid input { width: 18px; height: 18px; margin: 0; accent-color: var(--cyan-dark); }
.admin-permission-grid b, .admin-permission-grid small { display: block; }
.admin-permission-grid b { font-size: 10px; }
.admin-permission-grid small { margin-top: 3px; color: var(--muted); font: 7px/1.2 ui-monospace,monospace; }

:root[data-theme="dark"] .admin-nav button.is-active,
:root[data-theme="dark"] .admin-preset-category-list article.is-active { color: #102027; }
:root[data-theme="dark"] .admin-kpi-card,
:root[data-theme="dark"] .admin-chart-card,
:root[data-theme="dark"] .admin-events-card,
:root[data-theme="dark"] .admin-filterbar,
:root[data-theme="dark"] .admin-table-wrap,
:root[data-theme="dark"] .admin-preset-categories,
:root[data-theme="dark"] .admin-preset-actions,
:root[data-theme="dark"] .admin-operation-summary article,
:root[data-theme="dark"] .preset-import-list article,
:root[data-theme="dark"] .preset-import-categories button,
:root[data-theme="dark"] .preset-import-modal { color: var(--ink); background: var(--surface); }
:root[data-theme="dark"] .admin-table th { background: #17222c; }
:root[data-theme="dark"] .admin-search,
:root[data-theme="dark"] .admin-filterbar select,
:root[data-theme="dark"] .admin-row-action,
:root[data-theme="dark"] .admin-preset-row { color: var(--ink); background: var(--surface); }
:root[data-theme="dark"] .admin-preset-chivs { color: var(--orange); }
:root[data-theme="dark"] .preset-import-categories button.is-active { color: var(--ink); border-color: var(--cyan); background: #173a43; }
:root[data-theme="dark"] .admin-form-modal input,
:root[data-theme="dark"] .admin-form-modal select,
:root[data-theme="dark"] .admin-form-modal textarea { color: var(--ink); border-color: var(--line); background: var(--surface); }

@media (max-width: 1180px) {
  .admin-shell { grid-template-columns: 190px minmax(0,1fr); }
  .admin-kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .admin-overview-grid { grid-template-columns: 1fr; }
  .admin-sidebar { min-height: 560px; }
  .admin-preset-row { grid-template-columns: 42px minmax(150px,1fr) 110px 31px 31px; }
  .admin-preset-row .admin-status { display: none; }
}

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { min-height: 0; padding: 11px; }
  .admin-sidebar-heading, .admin-exit { display: none; }
  .admin-nav { grid-template-columns: repeat(4,minmax(0,1fr)); padding: 0; }
  .admin-nav button { grid-template-columns: 1fr; place-items: center; gap: 4px; min-height: 58px; padding: 5px; text-align: center; }
  .admin-nav button b { font-size: 8px; }
  .admin-preset-layout { grid-template-columns: 1fr; }
  .admin-preset-category-list { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .admin-preset-category-list article { min-width: 0; }
  .admin-preset-category-main { grid-template-columns: 30px minmax(0,1fr); }
}

@media (max-width: 620px) {
  .admin-page-heading { align-items: flex-start; margin-bottom: 14px; }
  .admin-page-heading p { max-width: 270px; font-size: 9px; }
  .admin-live { display: none; }
  .admin-nav button > span { width: 25px; height: 25px; font-size: 13px; }
  .admin-nav button b { max-width: 72px; font-size: 7px; line-height: 1.25; }
  .admin-kpi-grid { gap: 7px; }
  .admin-kpi-card { grid-template-columns: 35px minmax(0,1fr); gap: 8px; min-height: 90px; padding: 10px; }
  .admin-kpi-card > span { width: 35px; height: 35px; font-size: 15px; }
  .admin-kpi-card strong { font-size: 18px; }
  .admin-kpi-card b { font-size: 8px; }
  .admin-overview-grid { gap: 8px; margin-top: 8px; }
  .admin-chart-card, .admin-events-card { min-height: 300px; padding: 13px; }
  .admin-filterbar { grid-template-columns: 1fr 130px; gap: 7px; }
  .admin-filterbar > strong { grid-column: 1/-1; }
  .admin-preset-category-list { display: flex; padding-bottom: 5px; overflow-x: auto; }
  .admin-preset-category-list article { flex: 0 0 142px; }
  .admin-preset-actions { padding: 12px; }
  .admin-preset-actions .admin-card-heading { align-items: flex-start; }
  .admin-preset-actions .primary-button { min-height: 38px; padding-inline: 10px; font-size: 9px; }
  .admin-preset-row { grid-template-columns: 36px minmax(0,1fr) 29px 29px; min-height: 59px; padding: 7px; }
  .admin-preset-icon { width: 34px; height: 34px; font-size: 17px; }
  .admin-preset-chivs { grid-column: 2; font-size: 8px; }
  .admin-preset-row .admin-status { display: none; }
  .admin-operation-summary { grid-template-columns: 1fr; gap: 7px; }
  .admin-operation-summary article { min-height: 66px; }
  .preset-import-modal form { padding: 15px; }
  .preset-import-categories { grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; gap: 6px; }
  .preset-import-categories button { width: 100%; border-radius: 13px; }
  .preset-import-categories button span { font-size: 25px; }
  .preset-import-list { grid-template-columns: 1fr; max-height: 52vh; }
  .preset-import-list article { grid-template-columns: 24px 38px minmax(0,1fr) 90px; min-height: 68px; padding: 8px; }
  .preset-import-icon { width: 36px; height: 36px; }
  .preset-import-footer { align-items: flex-start; flex-direction: column; }
  .preset-import-footer .modal-actions { width: 100%; }
  .preset-import-footer .modal-actions button { flex: 1; padding-inline: 8px; }
}

.reward-category-manager-toggle { display: inline-flex; align-items: center; gap: 9px; }

.action-welcome-modal {
  width: min(480px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(8,18,24,.38);
}
.action-welcome-modal::backdrop { background: rgba(8,18,24,.7); backdrop-filter: blur(6px); }
.action-welcome {
  position: relative;
  display: grid;
  justify-items: center;
  padding: 32px;
  text-align: center;
}
.action-welcome-close { position: absolute; top: 16px; right: 16px; }
.action-welcome-visual {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  margin-bottom: 20px;
  border: 2px solid var(--charcoal);
  border-radius: 23px;
  background: var(--cyan-pale);
  box-shadow: 6px 6px 0 var(--cyan);
  font-size: 40px;
}
.action-welcome h2 { margin: 8px 0 10px; font-size: 25px; }
.action-welcome p { max-width: 390px; margin: 0 0 23px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.action-welcome-primary,
.action-welcome-secondary { width: 100%; min-height: 46px; }
.action-welcome-secondary { margin-top: 9px; }
.action-welcome-skip { margin-top: 14px; }

:root[data-theme="dark"] .action-welcome-modal { color: var(--ink); background: var(--surface); }

@media (max-width: 720px) {
  .reward-toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px; }
  .reward-toolbar-actions .primary-button { grid-column: 1 / -1; }
  .reward-toolbar-actions > button { justify-content: center; min-width: 0; }
}

@media (max-width: 480px) {
  .action-welcome { padding: 28px 20px 22px; }
  .action-welcome-visual { width: 72px; height: 72px; font-size: 35px; }
  .action-welcome h2 { font-size: 22px; }
}

/* Compact unified history */
.history-toolbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 10px;
}
.history-filters {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.history-filters button {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}
.history-filters button.is-active {
  color: #09232a;
  background: var(--cyan);
  box-shadow: 0 4px 10px rgba(0,191,227,.2);
}
.history-timezone-note {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 10px 2px 10px;
  color: var(--muted);
  font-size: 10px;
}
.history-timezone-note b { color: var(--cyan-dark); font-weight: 850; }
.history-layout { display: block; }
.history-feed { padding: 4px 14px; border-radius: 16px; }
.history-day-group + .history-day-group { border-top: 1px solid var(--line); }
.history-day-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
  padding: 7px 3px;
}
.history-day-heading strong,
.history-day-heading small { display: block; }
.history-day-heading strong { font-size: 12px; }
.history-day-heading small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.history-day-totals { display: flex; align-items: center; gap: 5px; }
.history-day-totals span {
  padding: 4px 6px;
  border-radius: 8px;
  background: var(--canvas);
  font-size: 9px;
  font-weight: 850;
}
.history-item {
  grid-template-columns: 34px minmax(0,1fr) auto auto;
  gap: 8px;
  min-height: 54px;
  padding: 7px 3px;
}
.history-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--cyan-pale);
}
.history-icon.reward { background: #fff2cc; }
.history-icon .ui-emoji { font-size: 19px; }
.history-main { min-width: 0; }
.history-main strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-main > small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}
.history-meta { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.history-meta time { color: var(--muted); font-size: 9px; font-weight: 750; }
.history-category { margin-top: 0; padding: 3px 6px; font-size: 8px !important; }
.history-points { min-width: 42px; font-size: 12px; text-align: right; }
.history-actions { display: flex; gap: 4px; }
.history-actions button {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
}
.history-actions button:hover { border-color: var(--cyan); background: var(--cyan-pale); }
.history-actions button:last-child:hover { border-color: var(--danger); background: #fff0ee; }
.history-summary {
  margin-bottom: 10px;
  padding: 11px 14px;
  border-radius: 14px;
}
.history-summary > .section-kicker {
  display: block;
  margin-bottom: 7px;
}
.history-summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.history-summary .summary-item {
  display: grid;
  gap: 4px;
  justify-items: start;
  padding: 2px 13px;
  border-right: 1px solid var(--line);
  border-bottom: 0;
}
.history-summary .summary-item:first-child { padding-left: 0; }
.history-summary .summary-item:last-child {
  padding-right: 0;
  border-right: 0;
}
.history-summary .summary-item span { font-size: 9px; }
.history-summary .summary-item strong { font-size: 14px; }
.history-edit-modal form,
.history-delete-modal form { padding: 20px; }
.history-edit-modal .modal-heading,
.history-delete-modal .modal-heading { margin-bottom: 15px; }
.history-edit-modal .modal-heading h2,
.history-delete-modal .modal-heading h2 { font-size: 21px; }
.history-edit-preview {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  background: var(--cyan-pale);
}
.history-edit-preview > span { font-size: 24px; text-align: center; }
.history-edit-preview strong,
.history-edit-preview small { display: block; }
.history-edit-preview strong { font-size: 11px; }
.history-edit-preview small { margin-top: 3px; color: var(--cyan-dark); font-size: 9px; font-weight: 850; }
.history-edit-fields { display: grid; grid-template-columns: 1.5fr 1fr; gap: 10px; }
.history-edit-fields label { margin-top: 13px; }
.history-edit-fields input { height: 42px; border-radius: 10px; }
.history-edit-hint {
  margin: 12px 0 0;
  padding: 9px 11px;
  border-left: 3px solid var(--cyan);
  color: var(--muted);
  background: var(--canvas);
  font-size: 9px;
  line-height: 1.45;
}
.history-edit-modal .modal-actions,
.history-delete-modal .modal-actions { margin-top: 16px; }
.history-delete-preview {
  padding: 12px;
  border-radius: 12px;
  background: var(--canvas);
}
.history-delete-preview strong { font-size: 12px; }
.history-delete-preview p,
.history-delete-warning { margin: 6px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.history-delete-warning { color: var(--danger); font-weight: 750; }

.avatar-change-confirmation {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--cyan-pale);
}
.avatar-change-preview {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border-radius: 16px;
  color: var(--charcoal);
  background: var(--orange);
  box-shadow: 0 0 0 3px rgba(0,191,227,.22);
  font-size: 23px;
  font-weight: 900;
}
.avatar-change-preview.has-photo { padding: 0; background: #fff; }
.avatar-change-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-change-confirmation strong { font-size: 12px; line-height: 1.45; }
.avatar-change-confirmation p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
:root[data-theme="dark"] .avatar-change-confirmation {
  color: var(--ink);
  border-color: var(--line);
  background: var(--cyan-pale);
}

.avatar-crop-modal { width: min(520px, calc(100vw - 28px)); }
.avatar-crop-modal .modal-heading { margin-bottom: 18px; }
.avatar-crop-modal .modal-heading h2 { font-size: 24px; }
.avatar-crop-editor { display: grid; justify-items: center; }
.avatar-crop-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: min(300px, calc(100vw - 86px));
  aspect-ratio: 1;
  padding: 10px;
  border-radius: 50%;
  background:
    linear-gradient(45deg, rgba(255,255,255,.055) 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,.055) 75%) 0 0 / 16px 16px,
    var(--charcoal);
  box-shadow: 0 0 0 5px var(--cyan-pale), 0 0 0 8px var(--cyan);
}
.avatar-crop-stage::after {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 2;
  border: 2px solid rgba(255,255,255,.78);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.22);
  pointer-events: none;
}
#avatarCropCanvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  outline: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
#avatarCropCanvas.is-dragging { cursor: grabbing; }
#avatarCropCanvas:focus-visible { box-shadow: 0 0 0 4px var(--orange); }
.avatar-crop-hint {
  margin: 18px 0 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}
.avatar-crop-hint span { color: var(--cyan-dark); font-size: 14px; }
.avatar-crop-controls {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: end;
  width: min(360px, 100%);
}
.avatar-crop-controls label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  margin: 0;
}
.avatar-crop-controls label > span,
.avatar-crop-controls output { color: var(--muted); font-size: 9px; font-weight: 800; }
.avatar-crop-controls output { color: var(--cyan-dark); }
.avatar-crop-controls input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  accent-color: var(--cyan);
  box-shadow: none;
  cursor: pointer;
}
.avatar-crop-controls input[type="range"]:focus { border: 0; box-shadow: 0 0 0 3px rgba(0,191,227,.14); }
.avatar-zoom-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface);
  font-size: 21px;
  font-weight: 700;
  cursor: pointer;
}
.avatar-zoom-button:hover { border-color: var(--cyan); background: var(--cyan-pale); }
.avatar-zoom-button:focus-visible { outline: 3px solid rgba(0,191,227,.25); outline-offset: 2px; }
:root[data-theme="dark"] .avatar-crop-stage { box-shadow: 0 0 0 5px #23333b, 0 0 0 8px var(--cyan-dark); }
:root[data-theme="dark"] .avatar-crop-hint span,
:root[data-theme="dark"] .avatar-crop-controls output { color: var(--cyan); }
:root[data-theme="dark"] .avatar-zoom-button { color: var(--ink); border-color: var(--line); background: var(--surface); }

:root[data-theme="dark"] .history-filters,
:root[data-theme="dark"] .history-actions button { color: var(--ink); border-color: var(--line); background: var(--surface); }
:root[data-theme="dark"] .history-filters button.is-active { color: #061a20; background: var(--cyan); }
:root[data-theme="dark"] .history-icon.reward { background: #443717; }
:root[data-theme="dark"] .history-actions button:hover { background: var(--cyan-pale); }
:root[data-theme="dark"] .history-actions button:last-child:hover { background: #40231f; }
:root[data-theme="dark"] .history-edit-preview { background: var(--cyan-pale); }

@media (max-width: 720px) {
  .avatar-crop-modal form { padding: 20px 16px; }
  .avatar-crop-stage { width: min(264px, calc(100vw - 74px)); }
  .avatar-crop-hint { margin-top: 16px; }
  .avatar-crop-modal .modal-actions { margin-top: 20px; }
  .history-toolbar { margin-bottom: 9px; }
  .history-filters { width: 100%; }
  .history-filters button { flex: 1; padding-inline: 7px; }
  .history-summary { padding: 10px 12px; }
  .history-summary > .section-kicker { margin-bottom: 6px; font-size: 8px; }
  .history-summary .summary-item { padding-inline: 9px; }
  .history-summary .summary-item span { font-size: 8px; }
  .history-summary .summary-item strong { font-size: 13px; }
  .history-timezone-note { align-items: flex-start; margin: 9px 2px; line-height: 1.35; }
  .history-feed { padding: 3px 9px; }
  .history-day-heading { min-height: 38px; padding-block: 6px; }
  .history-day-totals { gap: 3px; }
  .history-day-totals span { padding: 3px 5px; font-size: 8px; }
  .history-item {
    grid-template-columns: 30px minmax(0,1fr) 34px 54px;
    gap: 6px;
    min-height: 50px;
    padding: 6px 0;
  }
  .history-icon { width: 29px; height: 29px; }
  .history-icon .ui-emoji { font-size: 17px; }
  .history-main strong { font-size: 10px; }
  .history-main > small { font-size: 7px; }
  .history-meta { gap: 3px; }
  .history-meta time { font-size: 8px; }
  .history-category { padding: 2px 4px; font-size: 7px !important; }
  .history-points { min-width: 0; font-size: 10px; }
  .history-actions { grid-column: auto; justify-content: flex-end; gap: 3px; margin-top: 0; }
  .history-actions button { width: 25px; height: 25px; font-size: 12px; }
  .history-meta { flex-wrap: wrap; gap: 4px; }
  .history-day-heading { align-items: flex-start; }
  .history-day-totals { flex-wrap: wrap; justify-content: flex-end; max-width: 135px; }
  .history-edit-fields { grid-template-columns: 1fr 108px; }
}

/* Keep transient messages above the fixed mobile navigation. */
@media (max-width: 820px) {
  .toast {
    right: 12px;
    bottom: calc(88px + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    max-width: none;
  }
}

/* Achivo v0.12.0 · notifications */
.notification-bell {
  position: relative; display: grid; place-items: center; width: 46px; min-width: 46px; height: 46px; padding: 0;
  border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: var(--surface);
  box-shadow: 3px 3px 0 rgba(45,49,52,.08); cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.notification-bell:hover, .notification-bell.has-unread { border-color: color-mix(in srgb,var(--orange) 65%,var(--line)); background: color-mix(in srgb,var(--orange) 8%,var(--surface)); }
.notification-bell:hover { transform: translateY(-1px); }
.notification-bell > span { font-size: 19px; line-height: 1; }
.notification-bell > b {
  position: absolute; top: -7px; right: -7px; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
  border: 2px solid var(--canvas); border-radius: 999px; color: #fff; background: var(--danger); font-size: 8px; line-height: 1;
}
.notification-bell > b[hidden], .notification-preferences[hidden], .update-announcement[hidden] { display: none; }
.notification-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(8,18,24,.36); backdrop-filter: blur(2px); }
.notification-center {
  position: fixed; inset: 0 0 0 auto; z-index: 90; display: grid; grid-template-rows: auto auto minmax(0,1fr) auto;
  width: min(430px,100vw); padding: 20px; color: var(--ink); background: var(--surface); box-shadow: -22px 0 60px rgba(8,18,24,.24);
  transform: translateX(105%); transition: transform .24s ease;
}
.notification-center.is-open { transform: translateX(0); }
.notification-center-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 5px 2px 17px; }
.notification-center-heading h2 { margin: 0; font-size: 26px; letter-spacing: -.035em; }
.notification-center-heading > div:last-child { display: flex; align-items: center; gap: 9px; }
.notification-center-heading .text-button { color: var(--cyan-dark); font-size: 9px; font-weight: 900; }
.notification-center-heading .icon-button, .notification-preferences-heading .icon-button { width: 34px; height: 34px; border-radius: 10px; font-size: 19px; }
.notification-tabs { display: flex; gap: 5px; padding: 5px; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: var(--canvas); }
.notification-tabs button {
  flex: 1 0 auto; min-height: 34px; padding: 0 9px; border: 0; border-radius: 9px; color: var(--muted); background: transparent;
  font-size: 8px; font-weight: 900; cursor: pointer;
}
.notification-tabs button.is-active { color: #132126; background: var(--cyan); box-shadow: 2px 2px 0 var(--charcoal); }
.notification-list { margin-top: 12px; overflow-y: auto; overscroll-behavior: contain; }
.notification-item, .notification-preview-card {
  position: relative; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 11px; align-items: start;
  width: 100%; min-height: 92px; padding: 13px 10px; border: 0; border-bottom: 1px solid var(--line);
  color: var(--ink); background: transparent; text-align: left;
}
button.notification-item { cursor: pointer; }
button.notification-item:hover { background: color-mix(in srgb,var(--cyan) 5%,var(--surface)); }
.notification-item.is-unread { background: color-mix(in srgb,var(--cyan) 8%,var(--surface)); }
.notification-item-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #102027; background: var(--cyan-pale); font-size: 19px; }
.notification-item-icon.tone-updates { background: #fff0c9; }
.notification-item-icon.tone-nudges { background: #e7f8ee; }
.notification-item-icon.tone-system { background: #e8eef6; }
.notification-item-copy { min-width: 0; }
.notification-item-copy > span { display: flex; align-items: flex-start; gap: 7px; }
.notification-item-copy strong { font-size: 11px; line-height: 1.4; }
.notification-item-copy i { flex: 0 0 auto; width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: var(--cyan); }
.notification-item-copy small, .notification-item-copy time { display: block; }
.notification-item-copy small { margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.notification-item-copy time { margin-top: 7px; color: color-mix(in srgb,var(--muted) 78%,transparent); font-size: 8px; font-style: normal; }
.notification-item > b, .notification-preview-card > b { align-self: center; color: var(--muted); font-size: 24px; font-weight: 400; }
.notification-empty { display: grid; justify-items: center; align-content: center; min-height: 330px; padding: 30px; text-align: center; }
.notification-empty > span { font-size: 36px; }
.notification-empty strong { margin-top: 12px; font-size: 15px; }
.notification-empty p { margin: 7px 0 0; color: var(--muted); font-size: 10px; }
.notification-center-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 48px; padding: 10px 2px 0; border-top: 1px solid var(--line); }
.notification-center-footer .text-button { color: var(--cyan-dark); font-size: 9px; font-weight: 900; }
.notification-center-footer > span { color: var(--muted); font-size: 8px; }
.notification-preferences {
  position: absolute; inset: auto 12px 12px; z-index: 3; padding: 16px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); box-shadow: 0 18px 48px rgba(8,18,24,.2);
}
.notification-preferences-heading { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.notification-preferences-heading strong, .notification-preferences-heading small { display: block; }
.notification-preferences-heading strong { font-size: 13px; }
.notification-preferences-heading small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.notification-preferences > label { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 61px; border-top: 1px solid var(--line); }
.notification-preferences > label strong, .notification-preferences > label small { display: block; }
.notification-preferences > label strong { font-size: 10px; }
.notification-preferences > label small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.setting-switch.is-locked { opacity: .52; cursor: not-allowed; }

.update-announcement {
  position: fixed; right: 24px; bottom: 24px; z-index: 75; display: grid; grid-template-columns: 42px minmax(0,1fr) auto 27px;
  gap: 11px; align-items: center; width: min(460px,calc(100vw - 28px)); padding: 13px;
  border: 1px solid color-mix(in srgb,var(--cyan) 45%,var(--line)); border-radius: 17px; color: #fff; background: #20282c;
  box-shadow: 0 18px 55px rgba(8,18,24,.32); animation: update-in .35s ease both;
}
@keyframes update-in { from { opacity: 0; transform: translateY(16px); } }
.update-announcement > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--orange); font-size: 19px; }
.update-announcement strong, .update-announcement small { display: block; }
.update-announcement strong { font-size: 12px; }
.update-announcement small { margin-top: 4px; color: #bfc8cc; font-size: 9px; }
.update-announcement button { min-height: 33px; padding: 0 10px; border: 0; border-radius: 9px; color: #112027; background: var(--cyan); font-size: 9px; font-weight: 900; cursor: pointer; }
.update-announcement button:last-child { min-width: 27px; padding: 0; color: #c7d0d4; background: transparent; font-size: 18px; }

.changelog-modal { width: min(760px,calc(100vw - 28px)); max-height: min(880px,calc(100vh - 28px)); padding: 0; overflow: auto; border: 0; border-radius: 24px; box-shadow: 0 30px 90px rgba(8,18,24,.4); }
.changelog-modal::backdrop { background: rgba(8,18,24,.68); backdrop-filter: blur(5px); }
.changelog-modal > article { background: var(--surface); }
.changelog-hero, .changelog-preview-hero {
  position: relative; display: grid; align-content: center; min-height: 240px; padding: 32px; overflow: hidden; color: #fff;
  background: radial-gradient(circle at 82% 15%,rgba(0,191,227,.48),transparent 28%), linear-gradient(135deg,#283237,#111719);
}
.changelog-hero::after, .changelog-preview-hero::after { position: absolute; right: -30px; bottom: -55px; width: 180px; height: 180px; border: 20px solid rgba(252,170,7,.22); border-radius: 50%; content: ""; }
.changelog-hero span, .changelog-preview-hero span { color: #9de9f5; font: 900 12px/1 "Press Start 2P",ui-monospace,monospace; letter-spacing: .1em; }
.changelog-hero strong, .changelog-preview-hero strong { margin-top: 15px; font-size: 38px; letter-spacing: -.04em; }
.changelog-hero > i, .changelog-preview-hero > i { position: absolute; right: 58px; top: 58px; font-size: 58px; font-style: normal; transform: rotate(8deg); }
.changelog-hero.has-image, .changelog-preview-hero.has-image { display: block; padding: 0; }
.changelog-hero img, .changelog-preview-hero img { display: block; width: 100%; height: 100%; min-height: inherit; object-fit: cover; }
.changelog-content { padding: 28px 32px 34px; }
.changelog-content .modal-heading { align-items: flex-start; margin-bottom: 20px; }
.changelog-content .modal-heading h2 { max-width: 580px; margin-top: 3px; font-size: 28px; }
.changelog-body { color: var(--ink); font-size: 12px; line-height: 1.7; }
.changelog-body h2, .changelog-body h3 { margin: 24px 0 9px; font-size: 18px; line-height: 1.35; }
.changelog-body h2:first-child, .changelog-body h3:first-child { margin-top: 0; }
.changelog-body p { margin: 0 0 12px; color: color-mix(in srgb,var(--ink) 78%,var(--muted)); }
.changelog-body ul, .changelog-body ol { display: grid; gap: 7px; margin: 9px 0 16px; padding-left: 22px; }
.changelog-body a { color: var(--cyan-dark); font-weight: 800; }

.admin-notification-layout { display: grid; grid-template-columns: minmax(0,1.08fr) minmax(300px,.92fr); gap: 13px; }
.admin-notification-editor, .admin-notification-preview, .admin-notification-library { padding: 18px; border-radius: 18px; }
.admin-draft-badge, .admin-notification-status { display: inline-flex; align-items: center; min-height: 28px; padding: 0 9px; border-radius: 9px; color: #8c671b; background: #fff4d2; font-size: 8px; font-weight: 900; }
.admin-notification-status.is-published { color: #087657; background: #e5f8f1; }
.admin-notification-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 15px; }
.admin-notification-editor > label, .admin-notification-fields label { display: grid; gap: 6px; margin-top: 11px; color: var(--muted); font-size: 9px; font-weight: 850; }
.admin-notification-fields label { margin-top: 0; }
.admin-notification-editor input, .admin-notification-editor select, .admin-notification-editor textarea {
  width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); background: var(--surface); font: inherit; outline: none;
}
.admin-notification-editor textarea { line-height: 1.45; resize: vertical; }
.admin-notification-editor input:focus, .admin-notification-editor select:focus, .admin-notification-editor textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,191,227,.12); }
.admin-notification-image-field {
  display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 10px; align-items: center; min-height: 62px; margin-top: 13px; padding: 10px;
  border: 1px dashed color-mix(in srgb,var(--cyan) 50%,var(--line)); border-radius: 12px; background: color-mix(in srgb,var(--cyan) 4%,var(--surface));
}
.admin-notification-image-field strong, .admin-notification-image-field small { display: block; }
.admin-notification-image-field strong { font-size: 10px; }
.admin-notification-image-field small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.admin-notification-image-field .secondary-button { display: grid; place-items: center; min-height: 34px; padding-inline: 10px; font-size: 8px; cursor: pointer; }
.admin-notification-image-field .text-button { color: var(--danger); font-size: 8px; }
.rich-editor { margin-top: 13px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.rich-editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 7px; border-bottom: 1px solid var(--line); background: var(--canvas); }
.rich-editor-toolbar button { min-width: 31px; height: 29px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px; color: var(--muted); background: transparent; font-size: 8px; font-weight: 900; cursor: pointer; }
.rich-editor-toolbar button:hover { color: var(--ink); border-color: var(--line); background: var(--surface); }
.rich-editor-body { min-height: 200px; max-height: 360px; padding: 14px; overflow-y: auto; color: var(--ink); background: var(--surface); font-size: 11px; line-height: 1.6; outline: none; }
.rich-editor-body:focus { box-shadow: inset 0 0 0 2px var(--cyan); }
.rich-editor-body h2 { margin: 16px 0 7px; font-size: 17px; }
.rich-editor-body h2:first-child { margin-top: 0; }
.rich-editor-body p { margin: 0 0 9px; }
.rich-editor-body ul, .rich-editor-body ol { margin: 8px 0 12px; padding-left: 20px; }
.admin-notification-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.admin-notification-actions button { min-height: 40px; padding-inline: 13px; font-size: 9px; }
.admin-notification-preview { align-self: start; position: sticky; top: 18px; }
.admin-notification-preview .notification-preview-card { margin-top: 15px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb,var(--cyan) 5%,var(--surface)); }
.changelog-preview { margin-top: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.changelog-preview-hero { min-height: 125px; padding: 18px; }
.changelog-preview-hero span { font-size: 7px; }
.changelog-preview-hero strong { margin-top: 9px; font-size: 22px; }
.changelog-preview-hero > i { right: 26px; top: 26px; font-size: 32px; }
.changelog-preview > div:last-child { padding: 16px; }
.changelog-preview h3 { margin: 3px 0 12px; font-size: 17px; }
.changelog-preview .changelog-body { max-height: 210px; overflow: hidden; font-size: 9px; }
.admin-notification-library { margin-top: 13px; }
.admin-notification-list { display: grid; margin-top: 13px; }
.admin-notification-list article { display: grid; grid-template-columns: 38px minmax(0,1fr) auto 105px 31px; gap: 10px; align-items: center; min-height: 66px; padding: 8px 0; border-top: 1px solid var(--line); }
.admin-notification-list article > .notification-item-icon { width: 38px; height: 38px; border-radius: 11px; font-size: 17px; }
.admin-notification-list article > div strong, .admin-notification-list article > div small { display: block; }
.admin-notification-list article > div strong { font-size: 10px; }
.admin-notification-list article > div small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.admin-notification-list time { color: var(--muted); font-size: 8px; }

:root[data-theme="dark"] .notification-bell, :root[data-theme="dark"] .notification-center, :root[data-theme="dark"] .notification-preferences,
:root[data-theme="dark"] .changelog-modal > article, :root[data-theme="dark"] .admin-notification-editor,
:root[data-theme="dark"] .admin-notification-preview, :root[data-theme="dark"] .admin-notification-library,
:root[data-theme="dark"] .admin-notification-editor input, :root[data-theme="dark"] .admin-notification-editor select,
:root[data-theme="dark"] .admin-notification-editor textarea, :root[data-theme="dark"] .rich-editor-body,
:root[data-theme="dark"] .changelog-preview { color: var(--ink); background: var(--surface); }
:root[data-theme="dark"] .notification-tabs, :root[data-theme="dark"] .rich-editor-toolbar { background: var(--canvas); }
:root[data-theme="dark"] .notification-item.is-unread { background: #17333a; }
:root[data-theme="dark"] .admin-draft-badge { color: #ffd67d; background: #493712; }
:root[data-theme="dark"] .admin-notification-status.is-published { color: #76ddbd; background: #173b32; }

@media (max-width: 1180px) {
  .admin-notification-layout { grid-template-columns: 1fr; }
  .admin-notification-preview { position: static; }
}
@media (max-width: 900px) {
  .admin-nav { grid-template-columns: repeat(6,minmax(0,1fr)); }
}
@media (max-width: 620px) {
  .notification-bell { width: 40px; min-width: 40px; height: 40px; border-radius: 12px; box-shadow: none; }
  .notification-bell > b { top: -6px; right: -5px; }
  .notification-center { width: 100%; padding: 15px; }
  .notification-center-heading h2 { font-size: 23px; }
  .notification-center-heading .text-button { max-width: 80px; line-height: 1.25; }
  .notification-tabs button { padding-inline: 8px; }
  .update-announcement { right: 14px; bottom: 14px; grid-template-columns: 38px minmax(0,1fr) 27px; padding: 11px; }
  .update-announcement > span { width: 38px; height: 38px; }
  .update-announcement button:nth-last-child(2) { grid-column: 2; justify-self: start; min-height: 29px; margin-top: 3px; }
  .update-announcement button:last-child { grid-column: 3; grid-row: 1; }
  .changelog-hero { min-height: 180px; padding: 22px; }
  .changelog-hero strong { font-size: 29px; }
  .changelog-hero > i { right: 30px; top: 42px; font-size: 42px; }
  .changelog-content { padding: 22px 18px 26px; }
  .changelog-content .modal-heading h2 { font-size: 23px; }
  .admin-notification-fields { grid-template-columns: 1fr; }
  .admin-notification-image-field { grid-template-columns: minmax(0,1fr) auto; }
  .admin-notification-image-field .text-button { grid-column: 2; }
  .admin-notification-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .admin-notification-list article { grid-template-columns: 36px minmax(0,1fr) 31px; }
  .admin-notification-list .admin-notification-status, .admin-notification-list time { display: none; }
  .admin-nav button b { max-width: 58px; font-size: 6.5px; }
  .admin-owner-badge { display: none; }
  .admin-permission-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .nav-item,
  .app-shell.is-sidebar-collapsed .nav-item { color: #8b969c; background: transparent; }
  .nav-item:hover { color: #66737a; background: rgba(0,191,227,.04); }
  .nav-item.is-active {
    color: #087f96;
    border-color: var(--cyan);
    background: rgba(0,191,227,.055);
    box-shadow: none;
  }
  :root[data-theme="dark"] .nav-item,
  :root[data-theme="dark"] .app-shell.is-sidebar-collapsed .nav-item { color: #a7b2b8; background: transparent; }
  :root[data-theme="dark"] .nav-item:hover { color: #d7e0e4; background: rgba(255,255,255,.035); }
  :root[data-theme="dark"] .nav-item.is-active {
    color: #6ce0f2;
    border-color: var(--cyan);
    background: rgba(0,191,227,.07);
    box-shadow: none;
  }
}
