/*
  "Современный" theme — full visual replacement for styles.css.
  Same selectors/classes as the classic sheet (app.js output is identical),
  only the design language changes: warm editorial palette, dark forest
  sidebar, Fraunces/Inter type pairing, softer elevation, pill controls.
*/

:root {
  color-scheme: light;
  --bg: #faf6ee;
  --surface: #ffffff;
  --surface-soft: #f3ede0;
  --surface-green: #e7efe2;
  --surface-purple: #ece8f6;
  --surface-blue: #e6edf1;
  --surface-yellow: #f7ead1;
  --text: #241f19;
  --text-muted: #766b5c;
  --text-soft: #a89c88;
  --primary: #1f5b3f;
  --primary-hover: #163f2c;
  --primary-soft: #e1eadf;
  --green: #1f5b3f;
  --blue: #3e6e8e;
  --purple: #6b5ca5;
  --yellow: #b9812c;
  --accent: #c4623d;
  --danger: #b3432e;
  --border: #e8ddc8;
  --border-strong: #d9c9a9;
  --shadow-sm: 0 1px 2px rgba(36, 27, 15, 0.06);
  --shadow-md: 0 14px 32px -12px rgba(36, 27, 15, 0.18);
  --shadow-card: 0 1px 2px rgba(36, 27, 15, 0.04), 0 24px 48px -26px rgba(36, 27, 15, 0.28);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --sidebar-width: 296px;
  --content-max: 1240px;
  --page-gap: 20px;
  --font-display: "PT Serif", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sidebar-grad: linear-gradient(190deg, #24684a 0%, #163f2c 62%, #102e21 100%);
  --sidebar-text: #f6f1e2;
  --sidebar-text-muted: rgba(246, 241, 226, 0.62);
  --sidebar-border: rgba(255, 255, 255, 0.12);
  --sidebar-active-bg: rgba(255, 255, 255, 0.13);
  font-family: var(--font-body);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.muted {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Scroll reveal: cards fade/rise into place the first time they enter the
   viewport (app.js observes them once via IntersectionObserver, then stops
   watching — this never replays on re-renders, so it can't cause the
   flicker/jitter a repeating entrance animation would).
   Temporarily disabled — app.js still adds the classes and observes
   elements, but with no matching rule here it's a no-op. Uncomment to
   re-enable.
.scroll-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.scroll-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
*/

/* ---------- Login ---------- */

@keyframes badgeSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.login-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-stack {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 16px;
}

.login-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.login-corner-badge {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 1;
  display: grid;
  width: 84px;
  height: 84px;
  place-items: center;
  pointer-events: none;
}

.login-corner-badge .pulse-dot {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fdf0c8, #c4623d 72%);
  box-shadow: 0 0 0 8px var(--bg), 0 0 20px rgba(196, 98, 61, 0.35);
}

.login-corner-badge svg {
  width: 100%;
  height: 100%;
  animation: badgeSpin 16s linear infinite;
}

.login-corner-badge text {
  fill: var(--text-soft);
  font-size: 6.6px;
  letter-spacing: 0.05em;
}

@media (max-width: 680px) {
  .login-corner-badge {
    display: none;
  }
}

.login-card {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 440px);
  gap: 18px;
  padding: 34px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.login-card::before {
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--accent) 60%, var(--yellow));
  content: "";
}

.login-card h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 33px;
  font-weight: 620;
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.login-card h1 em {
  color: var(--primary-hover);
  font-style: italic;
  font-weight: 600;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-lockup p,
.brand-lockup strong {
  display: block;
  margin: 0;
}

.brand-lockup p {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 620;
}

.brand-lockup strong {
  margin-top: 3px;
  color: #574d3c;
  font-size: 12px;
  font-weight: 700;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-green);
  color: var(--primary);
}

.brand-mark::before {
  width: 26px;
  height: 26px;
  background: currentColor;
  content: "";
  -webkit-mask: url("/web/assets/icons/leaf.svg") center / contain no-repeat;
  mask: url("/web/assets/icons/leaf.svg") center / contain no-repeat;
}

.brand-mark.mini {
  width: 46px;
  height: 46px;
}

label {
  display: grid;
  gap: 7px;
  color: #3a3226;
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  background: #fffdf8;
  color: var(--text);
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

textarea {
  min-height: 116px;
  padding: 14px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(31, 91, 63, 0.68);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 91, 63, 0.13);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.checkbox-field input[type="checkbox"] {
  width: 18px;
  min-height: 0;
  height: 18px;
  padding: 0;
  accent-color: var(--primary);
}

/* ---------- Shell / sidebar ---------- */

.app-shell,
.course-app {
  display: grid;
  min-height: 100vh;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 30px;
  padding: 30px 20px 24px;
  background: var(--sidebar-grad);
  color: var(--sidebar-text);
}

.sidebar-brand {
  padding: 6px 2px 8px;
}

.sidebar-brand.brand-lockup p {
  color: var(--sidebar-text);
}

.sidebar-brand.brand-lockup strong {
  color: rgba(246, 241, 226, 0.85);
}

.sidebar-brand .brand-mark {
  border-color: var(--sidebar-border);
  background: rgba(255, 255, 255, 0.12);
  color: #f4d9a1;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.nav-item,
.nav-button {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
}

.side-nav .nav-button,
.side-nav .nav-item {
  color: var(--sidebar-text-muted);
}

.side-nav .nav-button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--sidebar-text);
}

.side-nav .nav-button.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text);
  box-shadow: inset 3px 0 0 0 #f4d9a1;
}

.side-nav .nav-button .ui-icon {
  color: inherit;
}

.ui-icon,
.inline-arrow {
  position: relative;
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  flex: 0 0 auto;
  color: currentColor;
}

.ui-icon::before,
.inline-arrow::before {
  display: block;
  width: 20px;
  height: 20px;
  background: currentColor;
  content: "";
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
}

.inline-arrow {
  width: 16px;
  height: 16px;
}

.inline-arrow::before {
  width: 16px;
  height: 16px;
}

.icon-sun { --icon-url: url("/web/assets/icons/sun.svg"); }
.icon-chart { --icon-url: url("/web/assets/icons/bar-chart.svg"); }
.icon-gear { --icon-url: url("/web/assets/icons/settings.svg"); }
.icon-help { --icon-url: url("/web/assets/icons/help.svg"); }
.icon-chat { --icon-url: url("/web/assets/icons/chat.svg"); }
.icon-refresh { --icon-url: url("/web/assets/icons/refresh.svg"); }
.icon-bell { --icon-url: url("/web/assets/icons/bell.svg"); }
.icon-close { --icon-url: url("/web/assets/icons/close.svg"); }
.icon-leaf { --icon-url: url("/web/assets/icons/leaf.svg"); }
.icon-mountain { --icon-url: url("/web/assets/icons/progress.svg"); }
.icon-user { --icon-url: url("/web/assets/icons/user.svg"); }
.icon-globe { --icon-url: url("/web/assets/icons/web.svg"); }
.icon-clock { --icon-url: url("/web/assets/icons/clock.svg"); }
.icon-language { --icon-url: url("/web/assets/icons/settings.svg"); }
.icon-shield { --icon-url: url("/web/assets/icons/shield.svg"); }
.icon-star { --icon-url: url("/web/assets/icons/star.svg"); }
.icon-trophy { --icon-url: url("/web/assets/icons/trophy.svg"); }
.icon-moon { --icon-url: url("/web/assets/icons/clock.svg"); }
.icon-lock { --icon-url: url("/web/assets/icons/lock.svg"); }
.icon-devices { --icon-url: url("/web/assets/icons/web.svg"); }
.icon-trash { --icon-url: url("/web/assets/icons/close.svg"); }
.icon-book { --icon-url: url("/web/assets/icons/book.svg"); }
.icon-heart { --icon-url: url("/web/assets/icons/heart.svg"); }
.icon-quote { --icon-url: url("/web/assets/icons/quote.svg"); }
.icon-image { --icon-url: url("/web/assets/icons/image.svg"); }
.icon-bulb { --icon-url: url("/web/assets/icons/lightbulb.svg"); }
.icon-film { --icon-url: url("/web/assets/icons/film.svg"); }
.icon-smile { --icon-url: url("/web/assets/icons/smile.svg"); }
.icon-lesson { --icon-url: url("/web/assets/icons/lesson.svg"); }
.icon-clipboard { --icon-url: url("/web/assets/icons/task.svg"); }
.icon-questionnaire { --icon-url: url("/web/assets/icons/survey.svg"); }
.icon-calendar { --icon-url: url("/web/assets/icons/calendar.svg"); }
.icon-fire { --icon-url: url("/web/assets/icons/fire.svg"); }
.icon-sprout { --icon-url: url("/web/assets/icons/leaf.svg"); }
.icon-lotus { --icon-url: url("/web/assets/icons/habit.svg"); }
.icon-arrow-right { --icon-url: url("/web/assets/icons/arrow-right.svg"); }

.card,
.soft-card,
.sync-card,
.link-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: 22px;
}

.sidebar .sync-card {
  margin-top: auto;
  border: 1px solid var(--sidebar-border);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
  padding: 18px;
}

.sync-card {
  display: grid;
  gap: 16px;
}

.sync-card h2 {
  margin: 0;
  color: var(--sidebar-text);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}

.sync-status-list {
  display: grid;
  gap: 12px;
}

.sync-status-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}

.sync-status-row strong,
.sync-status-row p {
  display: block;
  margin: 0;
}

.sync-status-row strong {
  color: var(--sidebar-text);
  font-size: 13px;
}

.sync-status-row p {
  color: var(--sidebar-text-muted);
  font-size: 12px;
}

.channel-logo {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
}

.channel-logo::before {
  width: 18px;
  height: 18px;
  background: currentColor;
  content: "";
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
}

.channel-logo.telegram {
  --icon-url: url("/web/assets/icons/telegram.svg");
  background: #25a7e8;
}

.channel-logo.max {
  --icon-url: url("/web/assets/icons/max.svg");
  background: #6d35d7;
}

.channel-logo.web {
  --icon-url: url("/web/assets/icons/web.svg");
  background: var(--primary);
}

.logout-button {
  justify-self: start;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--sidebar-text-muted);
  font-weight: 700;
}

.logout-button:hover {
  color: var(--sidebar-text);
}

/* ---------- Header / workspace ---------- */

.workspace,
.page {
  min-width: 0;
  padding: 34px 42px 52px;
}

.page-header,
.view {
  width: min(100%, var(--content-max));
  margin-right: auto;
  margin-left: auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.page-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 620;
  line-height: 1.06;
  letter-spacing: -0.015em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.icon-button:hover {
  border-color: var(--border-strong);
  color: var(--primary);
  transform: translateY(-1px);
}

.compact-icon {
  width: 34px;
  height: 34px;
  min-height: 34px;
}

.user-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 6px;
  border-left: 1px solid var(--border);
}

.user-mini strong,
.user-mini span {
  display: block;
}

.user-mini span {
  color: var(--text-muted);
  font-size: 12px;
}

.header-actions .logout-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.header-actions .logout-button:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-family: var(--font-display);
  font-weight: 700;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.content-grid,
.day-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 272px;
  gap: var(--page-gap);
  align-items: start;
}

.page-stack,
.day-main,
.right-rail,
.day-rail,
.progress-main,
.help-main,
.help-rail {
  display: grid;
  gap: var(--page-gap);
}

/* ---------- Hero (signature element: sunrise-over-ridge) ---------- */

.hero-day-card,
.today-hero {
  position: relative;
  display: grid;
  min-height: 200px;
  grid-template-columns: minmax(0, 1fr) 44%;
  gap: 20px;
  overflow: hidden;
  padding: 26px;
  background: linear-gradient(155deg, #fffdf6 0%, #faf3e2 100%);
}

.hero-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.hero-topline h2,
.hero-topline p,
blockquote {
  margin: 0;
}

.hero-topline h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 620;
}

.hero-topline p {
  margin-top: 4px;
  color: var(--text-muted);
}

blockquote p {
  max-width: 560px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  font-style: italic;
  line-height: 1.6;
}

blockquote footer {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.hero-illustration {
  position: relative;
  min-height: 158px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: linear-gradient(165deg, #fbf1d9 0%, #e6ddc0 32%, #a9c2a8 62%, #3f6c50 100%);
}

.hero-illustration::before,
.hero-illustration::after {
  position: absolute;
  content: "";
}

.hero-illustration::before {
  right: -18%;
  bottom: -30%;
  width: 130%;
  height: 62%;
  border-radius: 50%;
  background: linear-gradient(0deg, #133226 0%, rgba(19, 50, 38, 0.85) 45%, rgba(19, 50, 38, 0) 100%);
}

.hero-illustration::after {
  top: 24px;
  right: 34px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fdf0c8, #d99a3a 72%);
  box-shadow: 0 0 0 12px rgba(255, 255, 255, 0.16), 0 0 0 24px rgba(255, 255, 255, 0.08);
}

.day-progress {
  display: grid;
  max-width: 430px;
  gap: 9px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #4c8f6c);
  transition: width 220ms ease;
}

.hero-chips,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.chip.done {
  border-color: rgba(31, 91, 63, 0.28);
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-head h2,
.section-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 620;
  line-height: 1.2;
}

.section-head p {
  margin: 5px 0 0;
  color: var(--text-muted);
}

/* ---------- Materials / plan ---------- */

.materials-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.material-tile {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 16px;
  min-height: 112px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.material-tile:hover,
.material-tile.is-active {
  border-color: rgba(31, 91, 63, 0.4);
  background: linear-gradient(120deg, #fbfaf3, var(--surface-green));
  transform: translateY(-1px);
}

.material-icon,
.plan-icon,
.metric-icon,
.achievement-icon,
.habit-icon {
  display: inline-grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 16px;
  background: var(--surface-green);
  color: var(--primary);
}

.material-icon,
.achievement-icon {
  border-radius: 50%;
}

.material-icon::before,
.plan-icon::before,
.metric-icon::before,
.achievement-icon::before,
.habit-icon::before {
  display: block;
  width: 25px;
  height: 25px;
  background: currentColor;
  content: "";
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
}

.material-copy {
  display: grid;
  gap: 3px;
}

.material-copy strong {
  font-size: 16px;
  font-weight: 700;
}

.material-copy small {
  color: var(--text-muted);
  line-height: 1.4;
}

.material-copy em {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  color: var(--primary-hover);
  font-style: normal;
  font-weight: 800;
}

.material-result-card {
  margin-top: 16px;
  border-color: rgba(31, 91, 63, 0.18);
  background: linear-gradient(135deg, #fffdf7, var(--surface-green));
}

.material-content {
  display: grid;
  gap: 14px;
}

.material-content-body {
  display: grid;
  gap: 10px;
}

.material-content-body p,
.material-content > p {
  margin: 0;
  white-space: pre-wrap;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
}

.material-lead {
  font-weight: 700;
}

.material-caption {
  margin: 0;
  white-space: pre-wrap;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.material-quote {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.material-quote p {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  font-style: italic;
  line-height: 1.5;
}

.material-quote cite {
  color: var(--text-muted);
  font-size: 14px;
  font-style: normal;
}

.mood-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.mood-score-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 58px)) minmax(88px, auto);
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

.mood-score-button {
  min-height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--primary-hover);
  font-size: 18px;
  font-weight: 800;
}

.mood-score-button:hover {
  border-color: var(--primary);
  background: var(--surface-green);
}

.mood-score-button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.answer-edit-panel {
  display: grid;
  gap: 12px;
}

.answer-edit-score-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 58px));
  gap: 10px;
}

.answer-edit-actions {
  display: flex;
  gap: 10px;
}

.mood-back-button {
  min-height: 46px;
}

.daily-image {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
}

.mood-chart {
  display: grid;
  gap: 16px;
}

.mood-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 180px));
  gap: 12px;
}

.mood-summary-card {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}

.mood-summary-card span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.mood-summary-card strong {
  color: var(--primary-hover);
  font-size: 22px;
}

.mood-bars {
  display: grid;
  grid-auto-columns: minmax(56px, 1fr);
  grid-auto-flow: column;
  gap: 12px;
  min-height: 220px;
  align-items: end;
  overflow-x: auto;
  padding: 8px 2px 2px;
}

.mood-bar-item {
  display: grid;
  min-width: 56px;
  justify-items: center;
  gap: 7px;
}

.mood-bar-shell {
  display: flex;
  width: 38px;
  height: 146px;
  align-items: end;
  overflow: hidden;
  border-radius: 16px 16px 8px 8px;
  background: var(--surface-soft);
}

.mood-bar-fill {
  display: block;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(to top, var(--primary), #7fb491);
}

.mood-bar-item.is-empty .mood-bar-fill {
  height: 0 !important;
}

.mood-bar-item strong {
  font-size: 12px;
}

.mood-bar-item span {
  color: var(--text-muted);
  font-size: 11px;
}

.mood-distribution {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mood-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.flow-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.flow-panel-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 620;
}

.flow-messages,
.flow-message,
.flow-buttons {
  display: grid;
  gap: 12px;
}

.flow-message p {
  margin: 0;
  white-space: pre-wrap;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

.flow-buttons {
  display: flex;
  flex-wrap: wrap;
}

.flow-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
  align-items: end;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.flow-input textarea {
  min-height: 92px;
  resize: vertical;
}

.flow-input .primary-button {
  min-height: 44px;
  white-space: nowrap;
}

.plan-grid,
.task-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.plan-card {
  display: grid;
  min-height: 172px;
  align-content: start;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.plan-card.is-muted {
  background: var(--surface-soft);
}

.plan-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plan-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.plan-icon.yellow,
.time-pill.yellow {
  background: var(--surface-yellow);
  color: var(--yellow);
}

.plan-icon.purple,
.time-pill.purple {
  background: var(--surface-purple);
  color: var(--purple);
}

.plan-card h3,
.plan-title,
.plan-card p {
  margin: 0;
}

.plan-title {
  font-size: 15px;
  font-weight: 700;
}

.plan-card p {
  color: var(--text-muted);
}

.time-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 11px;
  font-weight: 800;
}

/* ---------- Right rail ---------- */

.rail-stats-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.rail-stat {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.rail-stat strong {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 620;
}

.rail-stat span:last-child {
  color: var(--text-muted);
  font-size: 12px;
}

.rail-divider {
  display: none;
}

.stat-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-yellow);
  color: var(--yellow);
}

.stat-icon::before {
  width: 22px;
  height: 22px;
  background: currentColor;
  content: "";
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
}

.stat-icon.fire {
  --icon-url: url("/web/assets/icons/fire.svg");
  background: #f7e2d8;
  color: var(--accent);
}

.stat-icon.star {
  --icon-url: url("/web/assets/icons/star.svg");
}

.rail-tip-card,
.rail-series-card {
  display: grid;
  gap: 8px;
  background: linear-gradient(150deg, #fff, var(--surface-green));
}

.rail-tip-card > .ui-icon,
.rail-series-card > .ui-icon {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-bottom: 2px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--primary);
}

.rail-tip-card h3,
.rail-series-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 620;
}

.rail-tip-card p,
.rail-series-card p {
  margin: 0;
  color: var(--text-muted);
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.calendar-head strong {
  font-family: var(--font-display);
  font-weight: 620;
}

.calendar-head span {
  color: var(--text-muted);
  font-size: 12px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-grid span {
  display: grid;
  min-height: 26px;
  place-items: center;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 12px;
}

.calendar-grid .is-active {
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.quick-actions-card {
  display: grid;
  gap: 6px;
}

.quick-actions-card h3,
.quick-actions-card button {
  margin: 0;
}

.quick-actions-card h3 {
  font-family: var(--font-display);
  font-weight: 620;
}

.quick-actions-card button,
.useful-links-card button,
.security-list button {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.quick-actions-card button:last-child {
  border-bottom: 0;
}

.quick-actions-card button:not(:disabled):hover,
.useful-links-card button:not(:disabled):hover,
.security-list button:not(:disabled):hover {
  color: var(--primary-hover);
}

.quick-actions-card button span::before,
.useful-links-card button i::before,
.security-list button::after {
  display: block;
  width: 16px;
  height: 16px;
  background: var(--text-soft);
  content: "";
  -webkit-mask: url("/web/assets/icons/arrow-right.svg") center / contain no-repeat;
  mask: url("/web/assets/icons/arrow-right.svg") center / contain no-repeat;
}

/* ---------- Buttons / badges ---------- */

.primary-button,
.text-button,
.text-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  font-weight: 750;
  text-decoration: none;
}

.primary-button {
  padding: 0 20px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 22px -12px rgba(31, 91, 63, 0.6);
}

.primary-button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.primary-button.yellow {
  background: var(--yellow);
  box-shadow: 0 10px 22px -12px rgba(185, 129, 44, 0.55);
}

.primary-button.purple {
  background: var(--purple);
  box-shadow: 0 10px 22px -12px rgba(107, 92, 165, 0.55);
}

.text-button {
  padding: 0 15px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--primary-hover);
}

.text-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.text-link {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary-hover);
}

.text-link:hover {
  border-color: var(--border-strong);
}

.compact {
  min-height: 34px;
  padding-inline: 13px;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.ok {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.badge.warn {
  background: var(--surface-yellow);
  color: #8a5a12;
}

.badge.neutral {
  background: var(--surface-soft);
  color: var(--text-muted);
}

.item-row,
.achievement-row,
.habit-row,
.occurrence-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.item-row strong,
.item-row span {
  display: block;
}

.item-row span {
  color: var(--text-muted);
  font-size: 13px;
}

.missed-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.empty-state {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text-muted);
}

/* ---------- Progress view ---------- */

.progress-screen-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 252px;
  gap: var(--page-gap);
  align-items: start;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: var(--page-gap);
}

.metric-card {
  display: grid;
  min-height: 120px;
  gap: 7px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.metric-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-green);
  color: var(--primary);
}

.metric-card.yellow .metric-icon { background: var(--surface-yellow); color: var(--yellow); }
.metric-card.yellow small { color: var(--yellow); }

.metric-card.blue .metric-icon { background: var(--surface-blue); color: var(--blue); }
.metric-card.blue small { color: var(--blue); }

.metric-card.purple .metric-icon { background: var(--surface-purple); color: var(--purple); }
.metric-card.purple small { color: var(--purple); }

.metric-card.rose .metric-icon { background: #f7e2dc; color: var(--danger); }
.metric-card.rose small { color: var(--danger); }

.metric-card span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-card strong {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 650;
  line-height: 1;
}

.metric-card small {
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
}

.progress-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: var(--page-gap);
}

.weekly-chart {
  display: flex;
  min-height: 260px;
  align-items: end;
  gap: 18px;
  padding: 14px 8px 0;
}

.week-bar {
  display: grid;
  flex: 1;
  justify-items: center;
  gap: 8px;
}

.week-bar-shell {
  display: flex;
  width: min(100%, 58px);
  height: 180px;
  align-items: end;
  overflow: hidden;
  border-radius: 18px 18px 8px 8px;
  background: var(--surface-soft);
}

.week-bar-fill {
  display: block;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(to top, var(--primary), #79ad8b);
}

.week-points {
  font-size: 13px;
  font-weight: 700;
}

.week-bar-label {
  color: var(--text-muted);
  font-size: 12px;
}

.chart-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-yellow);
  color: #7a5414;
  font-size: 13px;
}

.progress-side-card {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.streak-ring {
  display: grid;
  width: 126px;
  height: 126px;
  place-items: center;
  border: 9px solid var(--accent);
  border-left-color: #f0d3c1;
  border-radius: 50%;
}

.streak-ring span {
  display: block;
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 650;
  line-height: 1;
}

.streak-ring small {
  color: var(--text-muted);
  font-size: 11px;
}

.progress-side-card h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 620;
}

.achievement-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.achievement-row {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 16px 14px;
  text-align: center;
}

.achievement-icon {
  background: var(--surface-green);
}

.achievement-row.purple .achievement-icon { background: var(--surface-purple); color: var(--purple); }
.achievement-row.yellow .achievement-icon { background: var(--surface-yellow); color: var(--yellow); }
.achievement-row.blue .achievement-icon { background: var(--surface-blue); color: var(--blue); }

.achievement-row strong,
.achievement-row span {
  display: block;
}

.achievement-row span {
  color: var(--text-muted);
  font-size: 12px;
}

.habit-layout {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 14px;
}

.habit-form {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.habit-lists {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.8fr);
  gap: 14px;
}

.habit-list,
.occurrence-list {
  display: grid;
  gap: 10px;
}

.habit-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.habit-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.week-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.week-dots i {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 9px;
  font-style: normal;
}

.week-dots i.done {
  border-color: rgba(31, 91, 63, 0.45);
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.habit-streak {
  color: var(--primary-hover);
  font-weight: 700;
}

.occurrence-row {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}

.occurrence-row.is-due {
  border-color: rgba(31, 91, 63, 0.35);
  background: #fdfcf5;
}

.occurrence-row.is-planned,
.occurrence-row.is-missed {
  background: var(--surface-soft);
}

.occurrence-row.is-completed {
  border-color: rgba(31, 91, 63, 0.35);
  background: var(--primary-soft);
}

.occurrence-row span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.round-check {
  position: relative;
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: #fff;
}

.round-check.is-due {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 91, 63, 0.1);
}

.round-check.is-completed {
  border-color: var(--primary);
  background: var(--primary);
}

.round-check.is-completed::before {
  display: block;
  width: 15px;
  height: 15px;
  background: #fff;
  content: "";
  -webkit-mask: url("/web/assets/icons/check.svg") center / contain no-repeat;
  mask: url("/web/assets/icons/check.svg") center / contain no-repeat;
}

.round-check.is-planned,
.round-check.is-missed {
  border-color: var(--border);
  background: var(--surface-soft);
}

/* ---------- Settings ---------- */

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: var(--page-gap);
}

.settings-form,
.settings-list,
.security-list {
  display: grid;
  gap: 12px;
}

.setting-row {
  display: grid;
  grid-template-columns: 32px minmax(190px, 1fr) minmax(180px, 260px);
  gap: 14px;
  align-items: center;
  min-height: 56px;
}

.setting-row > .ui-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-green);
  color: var(--primary);
}

.setting-copy strong,
.setting-copy small {
  display: block;
}

.setting-copy small {
  color: var(--text-muted);
  font-weight: 500;
}

.settings-form > .primary-button {
  width: 100%;
  margin-top: 4px;
  grid-column: 1 / -1;
}

.security-note {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.toggle {
  position: relative;
  display: inline-flex;
  width: 48px;
  height: 28px;
  justify-self: end;
  border-radius: 999px;
  background: var(--border);
}

.toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 0;
  opacity: 0;
}

.toggle i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease;
}

.toggle input:checked + i,
.toggle.is-on i {
  transform: translateX(20px);
}

.toggle:has(input:checked),
.toggle.is-on {
  background: var(--primary);
}

.channel-list {
  display: grid;
  gap: 0;
}

.context-flow-panel {
  margin-top: 16px;
  border-color: rgba(31, 91, 63, 0.18);
  background: linear-gradient(135deg, #fffdf7, var(--surface-green));
}

.channel-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--border);
  border-bottom-width: 0;
  background: #fff;
}

.channel-row:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.channel-row:last-child {
  border-bottom-width: 1px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.channel-copy strong,
.channel-copy span,
.channel-copy p {
  display: block;
  margin: 0;
}

.channel-copy span,
.channel-copy p {
  color: var(--text-muted);
  font-size: 12px;
}

.security-list button {
  grid-template-columns: 32px minmax(0, 1fr) auto 12px;
  padding: 12px 0;
}

.security-list button .ui-icon {
  grid-row: 1 / span 2;
}

.security-list button strong,
.security-list button small {
  grid-column: 2;
}

.security-list button em {
  grid-column: 3;
  grid-row: 1 / span 2;
}

.security-list button::after {
  grid-column: 4;
  grid-row: 1 / span 2;
}

.security-list button small,
.security-list button em {
  color: var(--text-muted);
  font-style: normal;
  font-weight: 650;
}

.security-list .danger-row em {
  color: var(--danger);
}

.settings-banner,
.feedback-banner {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 240px;
  gap: 18px;
  align-items: center;
  margin-top: var(--page-gap);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--surface-green), #ffffff);
  box-shadow: var(--shadow-sm);
}

.settings-banner h2,
.settings-banner p,
.feedback-banner p {
  margin: 0;
}

.settings-banner h2 {
  font-family: var(--font-display);
  font-weight: 620;
}

.settings-banner p,
.feedback-banner p {
  color: var(--text-muted);
}

.banner-landscape,
.mini-landscape {
  min-height: 74px;
  border-radius: 14px;
  background: linear-gradient(150deg, #fbf1d9 0%, #dfe7d5 40%, #6f9a7c 100%);
}

/* ---------- Help ---------- */

.help-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  gap: var(--page-gap);
  align-items: start;
}

.faq-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.faq-item {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
  border-bottom: 0;
}

.faq-item > button {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 17px 18px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  text-align: left;
}

.faq-item > button i::before {
  display: block;
  width: 16px;
  height: 16px;
  background: var(--text-soft);
  content: "";
  transform: rotate(90deg);
  transition: transform 160ms ease;
  -webkit-mask: url("/web/assets/icons/arrow-right.svg") center / contain no-repeat;
  mask: url("/web/assets/icons/arrow-right.svg") center / contain no-repeat;
}

.faq-item.open {
  background: linear-gradient(120deg, #fffdf7, var(--surface-green));
}

.faq-item.open > button i::before {
  transform: rotate(-90deg);
  background: var(--primary);
}

.faq-item p {
  display: none;
  margin: 0;
  padding: 0 18px 18px;
  color: var(--text-muted);
}

.faq-item.open p {
  display: block;
}

.support-card,
.useful-links-card {
  display: grid;
  gap: 14px;
}

.support-form {
  display: grid;
  gap: 14px;
}

.support-form label {
  position: relative;
}

.support-form label span {
  position: absolute;
  right: 14px;
  bottom: 12px;
  color: var(--text-soft);
  font-weight: 500;
}

.support-form textarea {
  min-height: 128px;
  padding-bottom: 34px;
}

.support-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.tickets-card .ticket-list {
  display: grid;
  gap: 0;
}

.ticket-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.ticket-row:first-child {
  border-top: 0;
}

.ticket-row p,
.ticket-row small {
  display: block;
  margin: 0;
  color: var(--text-muted);
}

.useful-links-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 620;
}

.useful-links-card button {
  grid-template-columns: 32px minmax(0, 1fr) auto;
}

.useful-links-card button .ui-icon {
  grid-row: 1 / span 2;
}

.useful-links-card button strong,
.useful-links-card button small {
  grid-column: 2;
}

.useful-links-card button i {
  grid-column: 3;
  grid-row: 1 / span 2;
}

.useful-links-card button strong,
.useful-links-card button small {
  display: block;
}

.useful-links-card button small {
  color: var(--text-muted);
}

.feedback-banner {
  grid-template-columns: 44px minmax(0, 1fr);
  margin: 0;
  background: var(--surface-green);
}

/* ---------- Toast / theme toggle ---------- */

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(440px, calc(100vw - 36px));
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  background: #2a2118;
  color: #fff;
  box-shadow: var(--shadow-md);
  font-weight: 700;
  display: none;
}

.toast.visible {
  display: block;
}

.theme-toggle {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.92);
  backdrop-filter: blur(6px);
  color: var(--primary-hover);
  font-size: 12px;
  font-weight: 750;
  box-shadow: var(--shadow-md);
}

.theme-toggle:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.mobile-nav {
  display: none;
}

/* AI chat widget (ask-anything, grounded via FAQ/course RAG) */

.ai-chat-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.ai-chat-fab:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

body:not([data-auth="true"]) .ai-chat-fab {
  display: none;
}

.ai-chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 44;
  display: none;
  background: rgba(8, 10, 11, 0.45);
}

.ai-chat-backdrop.active {
  display: block;
}

.ai-chat-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  width: min(420px, 100vw);
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: -24px 0 60px -24px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms ease, opacity 220ms ease;
}

.ai-chat-drawer.active {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.ai-chat-drawer .flow-panel-head {
  padding: 20px 20px 12px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}

.flow-panel-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.ai-chat-message {
  display: grid;
  gap: 4px;
  max-width: 85%;
}

.ai-chat-message p {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.5;
}

.ai-chat-message.from-user {
  justify-self: end;
}

.ai-chat-message.from-user p {
  background: var(--primary);
  color: #fff;
}

.ai-chat-message.from-assistant {
  justify-self: start;
}

.ai-chat-message.from-assistant p {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.ai-chat-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-chat-typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: aiChatTypingBounce 0.9s infinite ease-in-out;
}

.ai-chat-typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.ai-chat-typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes aiChatTypingBounce {
  0%,
  80%,
  100% {
    transform: translateY(0) scale(1);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px) scale(1.1);
    opacity: 1;
  }
}

.ai-chat-drawer .flow-input {
  margin-top: 0;
  padding: 12px 20px 20px;
}

@media (max-width: 980px) {
  .ai-chat-fab {
    right: 12px;
    bottom: 78px;
  }
}

@media (max-width: 680px) {
  .ai-chat-drawer {
    width: 100vw;
  }
}

@media (max-width: 1280px) {
  .materials-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .progress-screen-grid,
  .content-grid,
  .day-grid,
  .help-grid {
    grid-template-columns: 1fr;
  }

  .right-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell,
  .course-app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .workspace,
  .page {
    padding: 20px 16px 92px;
  }

  .page-header,
  .view {
    max-width: 100%;
  }

  .page-header h1 {
    font-size: 30px;
  }

  .hero-day-card,
  .today-hero,
  .plan-grid,
  .task-grid,
  .progress-layout,
  .settings-grid,
  .habit-layout,
  .habit-lists,
  .setting-row,
  .channel-row,
  .settings-banner,
  .ticket-row {
    grid-template-columns: 1fr;
  }

  .right-rail {
    grid-template-columns: 1fr;
  }

  .settings-banner .banner-landscape {
    display: none;
  }

  .theme-toggle {
    left: 12px;
    bottom: 78px;
  }

  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: 66px;
    border-top: 1px solid var(--border);
    background: rgba(255, 253, 246, 0.97);
    backdrop-filter: blur(8px);
  }

  .mobile-nav .nav-button {
    min-height: 0;
    justify-content: center;
    padding: 0 6px;
    border-radius: 0;
    color: var(--text-muted);
    text-align: center;
    font-size: 12px;
  }

  .mobile-nav .nav-button.active {
    color: var(--primary-hover);
    box-shadow: inset 0 2px 0 0 var(--primary);
  }
}

@media (max-width: 680px) {
  .page-header,
  .header-actions,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .user-mini {
    border-left: 0;
    padding-left: 0;
  }

  .materials-grid,
  .metrics-grid,
  .achievement-list,
  .missed-list,
  .flow-input {
    grid-template-columns: 1fr;
  }

  .mood-score-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .mood-back-button {
    grid-column: 1 / -1;
  }

  .weekly-chart {
    gap: 8px;
    overflow-x: auto;
  }

  .week-bar {
    min-width: 52px;
  }

  .user-mini {
    justify-content: space-between;
  }

  .card,
  .soft-card,
  .sync-card,
  .link-card,
  .hero-day-card,
  .today-hero {
    padding: 16px;
  }

  .theme-toggle span:last-child {
    display: none;
  }

  .theme-toggle {
    padding: 0;
    width: 44px;
    height: 44px;
    justify-content: center;
  }
}
