:root {
  color-scheme: light;
  --navy: #1a1f36;
  --navy-soft: #242b49;
  --accent: #6c63ff;
  --accent-strong: #574ef0;
  --accent-2: #8b84ff;
  --mint: #00c9a7;
  --mint-strong: #00ad8f;
  --danger: #ff6b6b;
  --warn: #ffb347;
  --info: #3b82f6;

  /* Фоны — углублённые для контраста */
  --bg: #f0f2f8;
  --bg-elevated: #eaecf5;
  --bg-tinted: #e8ecf6;
  --bg-warm: #f5f0eb;

  /* Поверхности — иерархия */
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-recessed: #e8ecf4;
  --surface-elevated: rgba(255, 255, 255, 0.82);
  --surface-floating: #ffffff;

  /* Текст */
  --text: #1a1f36;
  --text-soft: #5b627b;
  --muted: #8a90a8;

  /* Бордеры — иерархия */
  --border-subtle: #eff1f5;
  --border: #e2e5ee;
  --border-strong: #d0d4e2;
  --border-accent: rgba(108, 99, 255, 0.16);

  /* Тени — иерархия */
  --shadow-subtle: 0 2px 8px rgba(26, 31, 54, 0.03);
  --shadow-card: 0 8px 24px rgba(26, 31, 54, 0.06);
  --shadow-elevated: 0 14px 36px rgba(26, 31, 54, 0.09);
  --shadow-floating: 0 24px 56px rgba(26, 31, 54, 0.14);
  --shadow-sm: var(--shadow-card);
  --shadow-md: var(--shadow-floating);

  /* Атмосферные токены */
  --ambient-accent: rgba(108, 99, 255, 0.04);
  --ambient-mint: rgba(0, 201, 167, 0.03);
  --ambient-warm: rgba(255, 179, 71, 0.03);

  /* Spacing */
  --space-section: 24px;
  --space-card-inner: 20px;
  --space-panel-gap: 14px;

  /* Radii */
  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-inset: 12px;

  /* Layout */
  --nav-h: 58px;
  --sidebar-w: 276px;
  --container: 1280px;

  /* Theme categories */
  --theme-work: #3b82f6;
  --theme-health: #00c9a7;
  --theme-study: #9b59b6;
  --theme-home: #f97316;
  --theme-none: #8a90a8;
}

html[data-ui-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e1e;
  --bg-elevated: #0f1328;
  --bg-tinted: #111731;
  --bg-warm: #1a1510;

  --surface: #171e38;
  --surface-2: #1b2340;
  --surface-recessed: #0f1428;
  --surface-elevated: rgba(29, 38, 68, 0.88);
  --surface-floating: #202a4d;

  --text: #f4f6fb;
  --text-soft: #c5cae0;
  --muted: #8a96b8;

  --border-subtle: #1e2847;
  --border: #263052;
  --border-strong: #324170;
  --border-accent: rgba(108, 99, 255, 0.22);

  --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-card: 0 10px 28px rgba(0, 0, 0, 0.2);
  --shadow-elevated: 0 18px 44px rgba(0, 0, 0, 0.28);
  --shadow-floating: 0 28px 64px rgba(0, 0, 0, 0.36);
  --shadow-sm: var(--shadow-card);
  --shadow-md: var(--shadow-floating);

  --ambient-accent: rgba(108, 99, 255, 0.06);
  --ambient-mint: rgba(0, 201, 167, 0.04);
  --ambient-warm: rgba(255, 179, 71, 0.04);
}

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

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  overflow-y: auto;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Onest", sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at 15% 5%, var(--ambient-accent), transparent 40%),
    radial-gradient(ellipse at 85% 90%, var(--ambient-mint), transparent 35%),
    radial-gradient(ellipse at 50% 50%, var(--ambient-warm), transparent 50%),
    linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 22%, var(--bg) 100%);
  background-attachment: fixed;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    border-color 180ms ease;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

img {
  max-width: 100%;
}

.hero-title,
.page-hero-title,
.form-hero-title,
.stats-hero-title,
.display-serif {
  font-family: "Cormorant Garamond", serif;
}

.page-title,
.brand-text,
.auth-title,
.form-title-text,
.message-title {
  font-family: "Onest", sans-serif;
}

.visually-hidden,
.sidebar-stats-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn,
.btn-icon,
.btn-order,
.page-link,
.pill-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 16px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  transition:
    background-color 140ms ease,
    color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.btn:hover,
.btn-icon:hover,
.btn-order:hover,
.page-link:hover,
.pill-link:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 26px rgba(108, 99, 255, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 18px 28px rgba(108, 99, 255, 0.3);
}

.btn-ghost,
.btn-outline,
.btn-order,
.page-link,
.btn-icon {
  color: var(--text-soft);
  background: var(--surface);
  border-color: var(--border);
}

.btn-outline:hover,
.btn-ghost:hover,
.btn-order:hover,
.page-link:hover,
.btn-icon:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.btn-danger {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.08);
  border-color: rgba(255, 107, 107, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.12);
}

.btn-success {
  color: #fff;
  background: linear-gradient(135deg, var(--mint), #00a98c);
  box-shadow: 0 14px 24px rgba(0, 201, 167, 0.22);
}

.btn-muted {
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--border);
}

.btn-sm,
.btn-icon,
.page-link {
  min-height: 38px;
  padding: 0 13px;
  font-size: 13px;
}

.btn-icon {
  min-width: 38px;
  padding: 0;
}

.chip,
.tag,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.badge-muted {
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.surface-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.surface-recessed {
  background: var(--surface-recessed);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.surface-elevated {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  backdrop-filter: blur(18px);
}

.surface-floating {
  background: var(--surface-floating);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-floating);
}

.tinted-section {
  background: var(--bg-tinted);
  border-radius: var(--radius-lg);
  padding: var(--space-section);
}

.confirm-modal[hidden] {
  display: none !important;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 19, 36, 0.56);
  backdrop-filter: blur(8px);
}

.confirm-modal-dialog {
  position: relative;
  width: min(100%, 440px);
  display: grid;
  gap: 16px;
  padding: 22px 22px 20px;
  border-radius: 22px;
  box-shadow: 0 28px 60px rgba(15, 19, 36, 0.28);
}

.confirm-modal-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  color: var(--danger);
  background: rgba(255, 107, 107, 0.1);
}

.confirm-modal-copy {
  display: grid;
  gap: 8px;
}

.confirm-modal-copy h2,
.confirm-modal-copy p {
  margin: 0;
}

.confirm-modal-copy h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.confirm-modal-copy p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 640px) {
  .confirm-modal {
    padding: 16px;
  }

  .confirm-modal-dialog {
    width: 100%;
    padding: 18px;
  }

  .confirm-modal-actions {
    flex-direction: column-reverse;
  }

  .confirm-modal-actions .btn {
    width: 100%;
  }
}

.page-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.page-lead {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.empty-state {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: 30px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}

.empty-state.centered {
  justify-items: center;
  text-align: center;
}

.empty-state-icon {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  color: var(--accent);
  background: rgba(108, 99, 255, 0.12);
}

.empty-state h3,
.empty-state h4 {
  margin: 0;
  font-size: 18px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.notification-stack {
  position: fixed;
  top: calc(var(--nav-h) + 16px);
  right: 18px;
  z-index: 2500;
  display: grid;
  gap: 10px;
}

.notification {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 360px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.notification-success {
  border-color: rgba(0, 201, 167, 0.3);
}

.notification-error {
  border-color: rgba(255, 107, 107, 0.32);
}

.notification-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--surface-2);
}

.notification-success .notification-icon {
  color: var(--mint);
}

.notification-error .notification-icon {
  color: var(--danger);
}

.notification-close {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.loading-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
}

@media (max-width: 960px) {
  :root {
    --sidebar-w: 100%;
  }

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