:root {
  color-scheme: light dark;
  --font-main: "Manrope", "SF Pro Display", "Avenir Next", "Helvetica Neue", sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --viewport-height: 100dvh;

  --tg-bg: #f5f7fc;
  --tg-secondary-bg: #eef3fb;
  --tg-text: #141824;
  --tg-hint: #6b7283;
  --tg-button: #0a84ff;
  --tg-button-text: #ffffff;

  --bg-top: #f8f9ff;
  --bg-bottom: #e9eefc;
  --surface: rgba(255, 255, 255, 0.56);
  --surface-strong: rgba(255, 255, 255, 0.86);
  --text-primary: #141824;
  --text-secondary: #5f6678;
  --text-tertiary: #7f889d;
  --accent: #207dff;
  --accent-soft: rgba(32, 125, 255, 0.18);
  --mint: #18c3a0;
  --violet: #6b74ff;
  --border-subtle: rgba(255, 255, 255, 0.46);
  --line-soft: rgba(16, 24, 40, 0.08);
  --shadow-card: 0 8px 20px rgba(25, 39, 90, 0.12);
  --shadow-soft: 0 6px 14px rgba(16, 24, 54, 0.1);
  --shine: rgba(255, 255, 255, 0.42);
}

body[data-theme="dark"] {
  --bg-top: #0d1322;
  --bg-bottom: #10182a;
  --surface: rgba(20, 31, 51, 0.58);
  --surface-strong: rgba(22, 35, 58, 0.78);
  --text-primary: #f6f8ff;
  --text-secondary: #bdc6da;
  --text-tertiary: #8d97ae;
  --accent-soft: rgba(94, 181, 255, 0.25);
  --mint: #44d8b4;
  --border-subtle: rgba(255, 255, 255, 0.11);
  --line-soft: rgba(255, 255, 255, 0.12);
  --shadow-card: 0 16px 38px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 10px 20px rgba(0, 0, 0, 0.3);
  --shine: rgba(255, 255, 255, 0.12);
}

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

html,
body {
  width: 100%;
  min-height: var(--viewport-height);
}

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

body {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.35;
  background:
    radial-gradient(900px 460px at 82% -12%, rgba(107, 116, 255, 0.24), transparent 58%),
    radial-gradient(700px 420px at -12% 15%, rgba(24, 195, 160, 0.20), transparent 60%),
    linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input {
  font: inherit;
}

button {
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.background-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.45;
  animation: float-orb 16s ease-in-out infinite;
}

.orb-a {
  width: 260px;
  height: 260px;
  background: radial-gradient(circle at 30% 30%, rgba(32, 125, 255, 0.50), rgba(32, 125, 255, 0));
  top: -50px;
  left: -70px;
  animation-delay: -2s;
}

.orb-b {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle at 60% 40%, rgba(24, 195, 160, 0.32), rgba(24, 195, 160, 0));
  top: 35%;
  right: -90px;
  animation-delay: -8s;
}

.orb-c {
  width: 240px;
  height: 240px;
  background: radial-gradient(circle at 50% 50%, rgba(107, 116, 255, 0.24), rgba(107, 116, 255, 0));
  bottom: -40px;
  left: 25%;
  animation-delay: -12s;
}

@keyframes float-orb {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -12px, 0);
  }
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(560px, 100%);
  min-height: var(--viewport-height);
  margin: 0 auto;
  padding:
    calc(14px + var(--safe-top))
    calc(16px + var(--safe-right))
    calc(110px + var(--safe-bottom))
    calc(16px + var(--safe-left));
}

.glass-card {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  background: linear-gradient(145deg, var(--surface-strong), var(--surface));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.glass-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--shine), transparent);
  pointer-events: none;
}

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.24)),
    linear-gradient(120deg, rgba(32, 125, 255, 0.16), rgba(24, 195, 160, 0.11));
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.avatar-badge {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  background:
    linear-gradient(145deg, rgba(32, 125, 255, 0.25), rgba(24, 195, 160, 0.20)),
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.45), transparent 58%);
  border: 1px solid var(--line-soft);
  box-shadow: 0 8px 18px rgba(32, 125, 255, 0.2);
}

.header-line {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.header-copy h1 {
  margin: 0;
  font-size: clamp(24px, 5.8vw, 29px);
  line-height: 1.1;
  font-weight: 820;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.header-copy p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.header-copy {
  min-width: 0;
}

.sync-chip {
  margin: 7px 0 0;
  min-height: 20px;
  max-width: 100%;
  width: fit-content;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: normal;
  overflow-wrap: anywhere;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.sync-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  min-width: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
  z-index: 2;
}

.sync-chip::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, 0.45) 50%, transparent 68%);
  transform: translateX(-120%);
  opacity: 0;
  pointer-events: none;
}

.sync-chip.is-loading {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.36);
}

.sync-chip.is-loading::before {
  animation: chip-dot-pulse 1.2s ease-in-out infinite;
}

.sync-chip.is-loading::after {
  opacity: 0.85;
  animation: chip-shimmer 1.8s linear infinite;
}

.sync-chip.is-ready {
  color: #0f8f71;
  border-color: rgba(15, 143, 113, 0.3);
  background: rgba(68, 216, 180, 0.16);
}

.sync-chip.is-error {
  color: #a41f35;
  border-color: rgba(244, 64, 94, 0.34);
  background: rgba(244, 64, 94, 0.14);
}

.sync-chip.is-demo {
  color: #6d7386;
  background: rgba(255, 255, 255, 0.28);
}

.header-pill {
  display: none;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0)),
    linear-gradient(150deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.26));
  color: var(--text-primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.16s ease, background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 10px 22px rgba(20, 26, 56, 0.14);
}

.icon-button.is-active {
  color: #0d926f;
  border-color: rgba(13, 146, 111, 0.34);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0)),
    linear-gradient(150deg, rgba(125, 242, 208, 0.42), rgba(255, 255, 255, 0.35));
  box-shadow: 0 12px 24px rgba(24, 195, 160, 0.24);
}

.icon-button:disabled {
  opacity: 0.74;
  cursor: default;
  pointer-events: none;
}

.icon-button:active {
  transform: scale(0.96);
}

.icon-svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-origin: 50% 20%;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.icon-button:hover .icon-svg,
.icon-button:focus-visible .icon-svg {
  transform: translateY(-1px) scale(1.04);
}

.icon-button:active .icon-svg {
  transform: scale(0.92);
}

.icon-button.is-active .icon-svg {
  animation: bell-ring 1.9s ease-in-out infinite;
}

.tab-container {
  margin-top: 14px;
}

.tab-screen {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.tab-screen.is-active {
  display: flex;
  animation: tab-enter 0.28s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes tab-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-card {
  padding: 18px;
  background:
    linear-gradient(138deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.24)),
    radial-gradient(420px 180px at 88% 2%, rgba(32, 125, 255, 0.2), transparent 72%);
}

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

.hero-top > div:first-child {
  min-width: 0;
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.hero-card h2,
.feature-hero h2,
.profile-block h2 {
  margin: 4px 0 0;
  font-size: clamp(28px, 7vw, 34px);
  line-height: 1.14;
  letter-spacing: -0.028em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.hero-subline {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.hero-chips {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-chip {
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.26);
  min-height: 28px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
}

.hero-chip-positive {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(130deg, var(--mint), #38b99b);
  box-shadow: 0 8px 14px rgba(24, 195, 160, 0.3);
}

.hero-chip-neutral {
  background: rgba(255, 255, 255, 0.34);
  color: var(--text-primary);
}

.hero-chip-neutral.is-good {
  color: #0f8f71;
  border-color: rgba(15, 143, 113, 0.28);
  background: rgba(68, 216, 180, 0.18);
}

.hero-chip-neutral.is-warn {
  color: #a35d00;
  border-color: rgba(250, 172, 20, 0.34);
  background: rgba(250, 172, 20, 0.18);
}

.hero-chip-neutral.is-danger {
  color: #a41f35;
  border-color: rgba(244, 64, 94, 0.34);
  background: rgba(244, 64, 94, 0.14);
}

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

.hero-stat {
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.3);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hero-stat span {
  font-size: 11px;
  color: var(--text-secondary);
}

.hero-stat strong {
  font-size: 15px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.ring {
  --size: 78px;
  width: var(--size);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    conic-gradient(
      from -30deg,
      var(--accent) calc(var(--progress, 0) * 1%),
      rgba(255, 255, 255, 0.22) 0%
    );
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.36), 0 10px 22px rgba(32, 125, 255, 0.2);
}

.ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  background: var(--surface-strong);
  border: 1px solid var(--border-subtle);
}

.ring span {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 800;
}

.ring.is-warn {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.36), 0 10px 22px rgba(250, 172, 20, 0.24);
}

.ring.is-danger {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.36), 0 10px 22px rgba(244, 64, 94, 0.24);
}

.progress-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.progress-head span,
.progress-head strong {
  min-width: 0;
}

.progress-head span {
  font-size: 14px;
  color: var(--text-secondary);
}

.progress-head strong {
  font-size: 14px;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(127, 141, 170, 0.24);
  overflow: hidden;
}

.progress-fill {
  display: block;
  width: min(100%, var(--fill, 0%));
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(120deg, var(--accent), #45b2ff);
  box-shadow: 0 0 12px rgba(69, 178, 255, 0.5);
}

.progress-fill.is-warn {
  background: linear-gradient(120deg, #f7b833, #ff9f43);
  box-shadow: 0 0 12px rgba(255, 172, 51, 0.45);
}

.progress-fill.is-danger {
  background: linear-gradient(120deg, #ff4f70, #ff7d63);
  box-shadow: 0 0 12px rgba(255, 94, 119, 0.45);
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
}

.btn {
  border: 0;
  border-radius: 16px;
  min-height: 62px;
  padding: 12px 14px;
  font-weight: 750;
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex-wrap: nowrap;
  text-align: left;
  transition: transform 0.14s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn-copy {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  align-items: flex-start;
}

.btn-copy strong {
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.btn-copy small {
  font-size: 11px;
  line-height: 1.2;
  color: var(--text-secondary);
}

.btn .btn-copy {
  min-width: 0;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.btn:disabled {
  opacity: 0.7;
  pointer-events: none;
}

.btn-primary {
  flex: 1;
  color: var(--tg-button-text);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0)),
    linear-gradient(130deg, var(--accent), #4f91ff);
  box-shadow: 0 12px 24px rgba(32, 125, 255, 0.34);
}

.btn-secondary {
  flex: 1;
  color: var(--text-primary);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.26));
  border: 1px solid var(--line-soft);
}

.btn-primary .btn-copy small {
  color: rgba(255, 255, 255, 0.86);
}

.btn-glyph {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  line-height: 1;
  opacity: 0.94;
  flex-shrink: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn-icon-svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn:hover .btn-glyph,
.btn:focus-visible .btn-glyph {
  transform: translateY(-1px) scale(1.06);
}

.btn:active .btn-glyph {
  transform: scale(0.9);
}

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

.panel h3 {
  margin: 2px 2px 0;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--text-tertiary);
}

.stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.compact-stack {
  gap: 8px;
}

.compact-item {
  padding: 13px 14px;
}

.priority-card {
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  width: 100%;
  text-align: left;
  color: inherit;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.2)),
    radial-gradient(280px 120px at 86% 12%, rgba(24, 195, 160, 0.18), transparent 70%);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 12px 22px rgba(17, 31, 64, 0.15);
}

.priority-label {
  margin: 0;
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.priority-card strong {
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.priority-card span {
  font-size: 14px;
  color: var(--text-secondary);
}

.list-item {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  width: 100%;
  text-align: left;
  color: inherit;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.16));
  padding: 14px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.list-item > div {
  min-width: 0;
  flex: 1;
}

.list-item strong {
  font-size: 16px;
  display: block;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.list-item p {
  margin: 2px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.recent-list {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.16));
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recent-empty {
  padding: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.recent-row {
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--line-soft);
}

.recent-row > div:first-child {
  min-width: 0;
  flex: 1;
}

.recent-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.recent-meta {
  margin-top: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.recent-meta-wrap {
  margin-top: 2px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.recent-badge {
  min-height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.34);
  display: inline-flex;
  align-items: center;
}

.recent-kcal {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  text-align: right;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.save-hint {
  margin: 2px 2px 0;
  min-height: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 650;
  color: transparent;
  transform: translateY(-4px);
  transition: max-height 0.2s ease, opacity 0.2s ease, transform 0.2s ease, padding 0.2s ease;
}

.save-hint.is-visible {
  max-height: 150px;
  opacity: 1;
  padding: 9px 12px;
  border-color: rgba(250, 172, 20, 0.34);
  background: rgba(250, 172, 20, 0.12);
  color: #9b5b00;
  transform: translateY(0);
}

.settings-card {
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.settings-summary {
  padding: 11px 13px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(32, 125, 255, 0.08);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.setting-row > div {
  flex: 1;
  min-width: 0;
}

.setting-row + .setting-row {
  border-top: 1px solid var(--line-soft);
}

.setting-row:hover {
  background: rgba(255, 255, 255, 0.2);
}

.setting-row:active {
  background: rgba(255, 255, 255, 0.27);
}

.setting-row:focus-visible {
  outline: 2px solid rgba(32, 125, 255, 0.4);
  outline-offset: -2px;
}

.setting-row strong {
  display: block;
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.setting-row p {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.input-card {
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 12px;
}

.input-card label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-card input {
  width: 100%;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.34);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 18px;
  min-height: 48px;
  height: auto;
  line-height: 1.25;
  padding: 0 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15);
}

.preset-card {
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preset-head strong {
  font-size: 15px;
}

.preset-head p {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.preset-segmented {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: rgba(255, 255, 255, 0.22);
  padding: 3px;
  gap: 4px;
}

.preset-btn {
  border: 0;
  border-radius: 10px;
  min-height: 40px;
  height: auto;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 8px 10px;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.14s ease;
}

.preset-btn:active {
  transform: scale(0.98);
}

.preset-btn.is-active {
  color: var(--text-primary);
  background: linear-gradient(130deg, var(--accent-soft), rgba(255, 255, 255, 0.35));
}

.feature-hero {
  padding: 16px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.2)),
    radial-gradient(320px 140px at 90% 0%, rgba(107, 116, 255, 0.18), transparent 70%);
}

.feature-hero p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.35;
}

.profile-block {
  padding: 14px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.18)),
    radial-gradient(300px 120px at 88% 8%, rgba(24, 195, 160, 0.16), transparent 74%);
}

.profile-top {
  display: flex;
  gap: 12px;
  align-items: center;
}

.profile-top > div:last-child {
  min-width: 0;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--mint));
  box-shadow: var(--shadow-soft);
}

.profile-top h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.profile-top p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.profile-tags {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-tags span {
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.20);
}

.chevron {
  width: 20px;
  min-width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.list-item:hover .chevron,
.list-item:focus-visible .chevron {
  transform: translateX(2px);
}

.list-item:active .chevron {
  transform: translateX(3px) scale(0.96);
}

.toggle {
  position: relative;
  width: 48px;
  height: 30px;
  flex-shrink: 0;
}

.toggle input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
}

.track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(130, 141, 163, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: background-color 0.2s ease;
}

.track::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s ease;
}

.toggle input:checked + .track {
  background: linear-gradient(120deg, var(--accent), #3ca6ff);
}

.toggle input:checked + .track::before {
  transform: translateX(18px);
}

.bottom-nav {
  position: fixed;
  width: min(540px, calc(100% - 24px - var(--safe-left) - var(--safe-right)));
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(12px + var(--safe-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 9px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.28));
  box-shadow: 0 14px 28px rgba(14, 21, 43, 0.18);
}

.tab-btn {
  position: relative;
  border: 0;
  border-radius: 15px;
  min-height: 58px;
  min-width: 0;
  padding: 7px 4px;
  background: transparent;
  color: var(--text-secondary);
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  gap: 2px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
  overflow: hidden;
}

.tab-btn:active {
  transform: scale(0.98);
}

.tab-btn::before {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
  transform: translateX(-50%) scaleX(0.45);
  transform-origin: center;
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.tab-btn.is-active {
  color: var(--text-primary);
  background:
    linear-gradient(145deg, var(--accent-soft), rgba(255, 255, 255, 0.34)),
    radial-gradient(80px 40px at 50% -10%, rgba(255, 255, 255, 0.42), transparent 85%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.36), 0 6px 14px rgba(32, 125, 255, 0.18);
}

.tab-btn.is-active::before {
  opacity: 0.98;
  transform: translateX(-50%) scaleX(1);
}

.tab-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
}

.tab-svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-origin: 50% 55%;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.tab-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-btn.is-active .tab-label {
  font-weight: 800;
}

.tab-btn:hover .tab-svg,
.tab-btn:focus-visible .tab-svg {
  transform: translateY(-1px) scale(1.04);
}

.tab-btn:active .tab-svg {
  transform: scale(0.94);
}

.tab-btn.is-active .tab-svg {
  transform: translateY(-0.5px) scale(1.02);
}

.tab-svg.is-pop {
  animation: tab-icon-pop 0.24s ease;
}

.tab-dirty-dot {
  position: absolute;
  top: 9px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff6b57;
  box-shadow: 0 0 0 2px rgba(255, 107, 87, 0.2);
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.tab-dirty-dot.is-visible {
  opacity: 1;
  transform: scale(1);
}

.pressable {
  transition: transform 0.14s ease, box-shadow 0.2s ease;
}

.pressable.is-pressed {
  transform: scale(0.99);
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  bottom: calc(88px + var(--safe-bottom));
  z-index: 40;
  border-radius: 13px;
  background: rgba(15, 22, 39, 0.86);
  color: #f4f7ff;
  padding: 10px 15px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(92vw, 360px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes bell-ring {
  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }
  10% {
    transform: rotate(12deg) scale(1.03);
  }
  20% {
    transform: rotate(-10deg);
  }
  30% {
    transform: rotate(7deg);
  }
  40% {
    transform: rotate(-5deg);
  }
  50% {
    transform: rotate(0deg);
  }
}

@keyframes tab-icon-pop {
  0% {
    transform: scale(0.92);
    opacity: 0.86;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes chip-shimmer {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

@keyframes chip-dot-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.72;
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
  }
}

body[data-theme="dark"] .top-header {
  background:
    linear-gradient(140deg, rgba(28, 40, 63, 0.84), rgba(21, 32, 53, 0.78)),
    linear-gradient(120deg, rgba(32, 125, 255, 0.2), rgba(24, 195, 160, 0.12));
}

body[data-theme="dark"] .hero-card,
body[data-theme="dark"] .feature-hero,
body[data-theme="dark"] .profile-block,
body[data-theme="dark"] .list-item,
body[data-theme="dark"] .recent-list,
body[data-theme="dark"] .recent-row,
body[data-theme="dark"] .btn-secondary,
body[data-theme="dark"] .priority-card {
  background: linear-gradient(145deg, rgba(29, 44, 70, 0.8), rgba(23, 34, 55, 0.66));
}

body[data-theme="dark"] .bottom-nav {
  background: linear-gradient(145deg, rgba(25, 38, 62, 0.9), rgba(20, 31, 49, 0.74));
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.36);
}

body[data-theme="dark"] .hero-chip {
  background: rgba(31, 45, 73, 0.84);
}

body[data-theme="dark"] .sync-chip.is-loading {
  background: rgba(21, 33, 56, 0.72);
}

body[data-theme="dark"] .sync-chip::after {
  background: linear-gradient(105deg, transparent 32%, rgba(176, 205, 255, 0.24) 50%, transparent 68%);
}

body[data-theme="dark"] .sync-chip.is-ready {
  color: #67d7b9;
  border-color: rgba(103, 215, 185, 0.35);
  background: rgba(50, 149, 126, 0.25);
}

body[data-theme="dark"] .sync-chip.is-error {
  color: #ff9cab;
  border-color: rgba(255, 156, 171, 0.35);
  background: rgba(149, 53, 74, 0.26);
}

body[data-theme="dark"] .sync-chip.is-demo {
  color: #b4c0d9;
  background: rgba(21, 33, 56, 0.62);
}

body[data-theme="dark"] .hero-chip-neutral {
  background: rgba(21, 33, 56, 0.76);
}

body[data-theme="dark"] .hero-chip-neutral.is-good {
  color: #67d7b9;
  border-color: rgba(103, 215, 185, 0.35);
  background: rgba(50, 149, 126, 0.25);
}

body[data-theme="dark"] .hero-chip-neutral.is-warn {
  color: #ffcf7b;
  border-color: rgba(255, 206, 120, 0.35);
  background: rgba(177, 115, 27, 0.25);
}

body[data-theme="dark"] .hero-chip-neutral.is-danger {
  color: #ff9cab;
  border-color: rgba(255, 156, 171, 0.35);
  background: rgba(149, 53, 74, 0.26);
}

body[data-theme="dark"] .hero-stat {
  background: rgba(21, 33, 56, 0.72);
}

body[data-theme="dark"] .recent-badge {
  background: rgba(21, 33, 56, 0.72);
}

body[data-theme="dark"] .settings-summary {
  background: rgba(94, 181, 255, 0.13);
}

body[data-theme="dark"] .save-hint.is-visible {
  border-color: rgba(255, 199, 102, 0.35);
  background: rgba(170, 118, 29, 0.24);
  color: #ffd38c;
}

body[data-theme="dark"] .setting-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

body[data-theme="dark"] .setting-row:active {
  background: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .icon-button.is-active {
  color: #78efcd;
  border-color: rgba(120, 239, 205, 0.32);
  background: linear-gradient(145deg, rgba(40, 120, 102, 0.45), rgba(26, 64, 71, 0.44));
  box-shadow: 0 12px 24px rgba(40, 120, 102, 0.3);
}

@media (max-width: 380px) {
  .top-header {
    align-items: flex-start;
  }

  .header-pill {
    display: none;
  }

  .hero-card h2,
  .feature-hero h2,
  .profile-block h2 {
    font-size: 26px;
  }

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

  .hero-stat:last-child {
    grid-column: 1 / -1;
  }

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

  .btn {
    width: 100%;
  }

  .hero-top {
    flex-direction: column;
    gap: 12px;
  }

  .ring {
    --size: 70px;
  }

  .setting-row {
    gap: 10px;
    padding: 11px 12px;
  }

  .setting-row strong {
    font-size: 14px;
  }

  .setting-row p {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.28;
  }

  .tab-label {
    font-size: 11px;
  }
}

@media (max-width: 460px) {
  .button-row {
    grid-template-columns: 1fr;
  }

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

  .hero-stat:last-child {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
