/* ===== CSS Variables ===== */
:root {
  --bg: #F5F0E8;
  --surface1: #FDFAF4;
  --surface2: #EDE8DF;
  --surface3: #E2DDD4;
  --border: #D8D2C8;
  --text: #2D2820;
  --muted: #8C8070;
  --accent: #E8733A;
  --accent2: #C0634A;
  --accent3: #5B8A6F;
  --blue: #5B7FA6;
  --gold: #C49A3C;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 2px 12px rgba(45, 40, 32, 0.06);
  --shadow-lg: 0 4px 24px rgba(45, 40, 32, 0.1);
  --transition: 0.25s ease;

  --font-heading: 'Fraunces', serif;
  --font-body: 'Golos Text', sans-serif;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 0%, rgba(232, 115, 58, 0.06) 0%, transparent 50%),
                    radial-gradient(ellipse at 80% 100%, rgba(91, 138, 111, 0.05) 0%, transparent 50%);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== App Container ===== */
.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 240, 232, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header__logo {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header__logo-accent {
  color: var(--accent);
}

.header__right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.85rem;
}

.header__crystals {
  font-weight: 600;
  color: var(--gold);
}

.header__time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.header__settings {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface2);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.header__settings:active {
  transform: scale(0.9);
}

/* ===== Screen Headers (per-tab) ===== */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 240, 232, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin: 0 -16px;
}

.screen-header__title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Home screen header */
.screen-header--home {
  padding: 14px 20px;
}

.screen-header__logo {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.screen-header__logo-accent {
  color: var(--accent);
}

.screen-header__right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.85rem;
}

.screen-header__crystals {
  font-weight: 600;
  color: var(--gold);
}

.screen-header__time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.screen-header__btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface2);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.screen-header__btn:active {
  transform: scale(0.9);
}

/* Sub-screen header (with back button) */
.screen-header--sub {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.screen-header--sub .screen-header__title {
  text-align: center;
}

.screen-header__back {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-body);
}

.screen-header__back:active {
  opacity: 0.7;
}

/* Hide tab bar on sub-screens */
.app.subscreen-active .tab-bar {
  display: none;
}

/* ===== Content ===== */
.content {
  flex: 1;
  padding: 0 16px 100px;
  overflow-y: auto;
}

/* ===== Tab Panels ===== */
.tab-panel {
  display: none;
  animation: fadeUp 0.3s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Tab Bar ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  background: rgba(253, 250, 244, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 6px 4px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  z-index: 200;
}

.tab-bar__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px 4px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.tab-bar__btn:active {
  transform: scale(0.93);
}

.tab-bar__icon {
  font-size: 1.3rem;
  line-height: 1;
}

.tab-bar__label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted);
  transition: color var(--transition);
}

.tab-bar__btn.active {
  background: rgba(232, 115, 58, 0.1);
}

.tab-bar__btn.active .tab-bar__label {
  color: var(--accent);
  font-weight: 600;
}

/* ===== Cards ===== */
.card {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.card h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

/* ===== Dark Card (for streak widget) ===== */
.card--dark {
  background: linear-gradient(135deg, #2D2820 0%, #3D3530 100%);
  color: #F5F0E8;
  border-color: transparent;
}

.card--dark .text-muted {
  color: rgba(245, 240, 232, 0.5);
}

/* ===== Chip Buttons ===== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 50px;
  background: var(--surface1);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.chip:active {
  transform: scale(0.95);
}

.chip.selected {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.chip--emotion {
  flex-direction: column;
  padding: 12px 10px;
  min-width: 72px;
  text-align: center;
  border-radius: var(--radius-sm);
}

.chip--emotion .chip__emoji {
  font-size: 1.6rem;
}

.chip--emotion .chip__label {
  font-size: 0.7rem;
  font-weight: 500;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 16px rgba(232, 115, 58, 0.3);
}

.btn--primary:disabled {
  background: var(--surface3);
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
}

.btn--primary:not(:disabled):hover {
  box-shadow: 0 6px 20px rgba(232, 115, 58, 0.4);
}

.btn--secondary {
  background: var(--surface2);
  color: var(--text);
}

.btn--full {
  width: 100%;
}

/* ===== Range Slider ===== */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--surface3);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(232, 115, 58, 0.3);
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(232, 115, 58, 0.3);
}

/* ===== Form Elements ===== */
input[type="time"],
input[type="text"],
textarea {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition);
}

input[type="time"]:focus,
input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 80px;
}

/* ===== Section Titles ===== */
.section-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

/* ===== Collapsible Sections ===== */
.collapsible__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.collapsible__header h3 {
  font-size: 0.9rem;
  font-weight: 600;
}

.collapsible__arrow {
  font-size: 0.75rem;
  color: var(--muted);
  transition: transform var(--transition);
}

.collapsible.open .collapsible__arrow {
  transform: rotate(180deg);
}

.collapsible__body {
  display: none;
  padding-bottom: 8px;
}

.collapsible.open .collapsible__body {
  display: block;
  animation: fadeUp 0.2s ease;
}

/* ===== Progress Bar ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--surface3);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.5s ease;
}

.progress-bar__fill--gold {
  background: var(--gold);
}

.progress-bar__fill--green {
  background: var(--accent3);
}

/* ===== Utility ===== */
.text-muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.text-accent {
  color: var(--accent);
}

.text-gold {
  color: var(--gold);
}

.text-green {
  color: var(--accent3);
}

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ===== Tab Placeholder ===== */
.tab-placeholder {
  padding-top: 20px;
}

.tab-placeholder .card {
  text-align: center;
  padding: 40px 20px;
}

.tab-placeholder .card h2 {
  margin-bottom: 12px;
}

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(45, 40, 32, 0.4);
  backdrop-filter: blur(4px);
  z-index: 300;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 430px;
  max-height: 85dvh;
  background: var(--surface1);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal__handle {
  width: 40px;
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  margin: 0 auto 16px;
}

/* ===== Badge Grid ===== */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 8px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  gap: 6px;
}

.badge__icon {
  font-size: 1.8rem;
}

.badge__name {
  font-size: 0.75rem;
  font-weight: 600;
}

.badge--locked {
  opacity: 0.4;
  filter: grayscale(1);
}

.badge--unlocked {
  background: var(--surface1);
  box-shadow: var(--shadow);
}

/* ===== Streak Widget ===== */
.streak-widget {
  padding: 20px;
}

.streak-widget__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.streak-widget__fire {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.streak-widget__fire-icon {
  font-size: 1.6rem;
}

.streak-widget__fire-num {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: #F5F0E8;
  line-height: 1;
}

.streak-widget__fire-label {
  font-size: 0.8rem;
  color: rgba(245, 240, 232, 0.6);
}

.streak-widget__freezes {
  display: flex;
  gap: 4px;
}

.freeze-slot {
  font-size: 1.1rem;
  opacity: 0.25;
}

.freeze-slot--active {
  opacity: 1;
}

.streak-widget__level {
  margin-bottom: 12px;
}

.streak-widget__level-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.streak-widget__level-name {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold);
}

.streak-widget__level-xp {
  font-size: 0.75rem;
  color: rgba(245, 240, 232, 0.5);
}

.streak-widget .progress-bar {
  background: rgba(245, 240, 232, 0.15);
}

.streak-widget__avg {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.streak-widget__avg-val {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent3);
}

/* ===== Week Goal ===== */
.week-goal__btns {
  display: flex;
  gap: 8px;
}

.week-goal__btns .btn {
  flex: 1;
  padding: 10px 8px;
  font-size: 0.85rem;
}

.week-goal__info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ===== Mini Calendar ===== */
.mini-cal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.mini-cal__month {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  text-transform: capitalize;
}

.mini-cal__nav {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface2);
  font-size: 1.1rem;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.mini-cal__nav:active {
  transform: scale(0.9);
}

.mini-cal__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.mini-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.cal-day:empty {
  cursor: default;
}

.cal-day--today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  font-weight: 700;
}

.cal-day--none {
  color: var(--muted);
  background: transparent;
}

.cal-day--score-1, .cal-day--score-2, .cal-day--score-3 {
  background: #E8A49A;
  color: #5C2018;
}

.cal-day--score-4, .cal-day--score-5 {
  background: #E8C49A;
  color: #5C3A18;
}

.cal-day--score-6, .cal-day--score-7 {
  background: #E2D88A;
  color: #4A4518;
}

.cal-day--score-8, .cal-day--score-9, .cal-day--score-10 {
  background: #A2D4A8;
  color: #1C4A22;
}

.cal-day--no-data {
  background: var(--surface2);
  color: var(--muted);
}

.cal-day--future {
  color: var(--surface3);
  cursor: default;
}

/* ===== History ===== */
.history {
  padding-top: 12px;
}

.history__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 4px;
}

.history__week-label {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
}

.history__summary {
  padding: 16px 20px;
}

.history__stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.history__stat {
  text-align: center;
}

.history__stat-val {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  display: block;
}

.history__stat-val--green { color: var(--accent3); }
.history__stat-val--red { color: var(--accent2); }
.history__stat-val--accent { color: var(--accent); }

.history__stat-label {
  font-size: 0.7rem;
  color: var(--muted);
}

.history__top-emotions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history__top-emotions .chip {
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: default;
}

/* Entry cards in history */
.entry-card {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all var(--transition);
}

.entry-card:active {
  transform: scale(0.98);
}

.entry-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.entry-card__emotion {
  display: flex;
  align-items: center;
  gap: 8px;
}

.entry-card__emoji {
  font-size: 1.4rem;
}

.entry-card__name {
  font-weight: 600;
  font-size: 0.9rem;
}

.entry-card__score {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.entry-card__time {
  font-size: 0.75rem;
  color: var(--muted);
}

.entry-card__text {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.entry-card__tag {
  font-size: 0.65rem;
  padding: 2px 8px;
  background: var(--surface2);
  border-radius: 20px;
  color: var(--muted);
}

.entry-card--hidden {
  opacity: 0.4;
}

.history__empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

/* ===== Edit Modal ===== */
.edit-modal__emotion {
  font-size: 1.2rem;
  text-align: center;
}

.edit-modal__actions {
  display: flex;
  gap: 10px;
}

.edit-modal__actions .btn {
  flex: 1;
}

/* ===== Entry Form ===== */
.entry-form {
  padding-top: 12px;
}

/* Emotion Grid */
.emotion-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

/* Intensity Block */
.intensity-block {
  padding-top: 4px;
}

.intensity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.intensity-value {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 28px;
  text-align: right;
}

.intensity-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--muted);
}

/* Sleep Row */
.sleep-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.sleep-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sleep-label .text-muted {
  font-size: 0.75rem;
}

.sleep-hours {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  color: var(--accent3);
  white-space: nowrap;
  padding-bottom: 10px;
}

/* Chip Group */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Weather Chips */
.chip--weather {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 1.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface1);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.chip--weather:active {
  transform: scale(0.93);
}

.chip--weather.selected {
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 2px 10px rgba(91, 127, 166, 0.3);
}

/* Save Button Area */
.save-reward {
  text-align: center;
  margin-top: 8px;
  margin-bottom: 20px;
  font-weight: 600;
  color: var(--gold);
  min-height: 20px;
}

/* Save Result Screen */
.save-result {
  padding-top: 40px;
}

.save-result__card {
  text-align: center;
  padding: 40px 24px 32px;
}

.save-result__emoji {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: popIn 0.4s ease;
}

.save-result__emotion {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.save-result__tags {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
  min-height: 20px;
}

.save-result__crystals {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 8px;
  animation: popIn 0.5s ease 0.15s both;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  70% {
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===== Center Add Button ===== */
.tab-bar__add {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: 4px solid var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: -28px;
  box-shadow: 0 4px 16px rgba(232, 115, 58, 0.35);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.tab-bar__add:active {
  transform: scale(0.9);
  box-shadow: 0 2px 8px rgba(232, 115, 58, 0.3);
}

.tab-bar__add-icon {
  font-size: 1.8rem;
  font-weight: 300;
  color: white;
  line-height: 1;
}

/* ===== Home Widgets ===== */
.home-widgets {
  padding-top: 12px;
}

/* ===== Flow Overlay ===== */
.flow-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 0%, rgba(232, 115, 58, 0.06) 0%, transparent 50%),
                    radial-gradient(ellipse at 80% 100%, rgba(91, 138, 111, 0.05) 0%, transparent 50%);
}

.flow-overlay.active {
  display: flex;
}

.flow {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.flow__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  flex-shrink: 0;
}

.flow__close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface1);
  font-size: 1rem;
  cursor: pointer;
  color: var(--muted);
  transition: all var(--transition);
}

.flow__close:active {
  transform: scale(0.9);
}

.flow__progress {
  display: flex;
  gap: 8px;
  align-items: center;
}

.flow__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface3);
  transition: all var(--transition);
}

.flow__dot.active {
  background: var(--accent);
  width: 24px;
  border-radius: 4px;
}

.flow__dot.done {
  background: var(--accent3);
}

.flow__step-label {
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 36px;
  text-align: right;
}

/* Flow Steps */
.flow__step {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
}

.flow__step.active {
  display: block;
  animation: fadeUp 0.25s ease;
}

.flow__title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Flow Date Picker */
.flow__date-picker {
  margin-bottom: 20px;
  position: relative;
}

.flow__date-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 50px;
  background: var(--surface1);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.flow__date-btn:active {
  transform: scale(0.97);
}

.flow__date-input-hidden {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  border: none;
  pointer-events: none;
  overflow: hidden;
}

/* Flow Sleep */
.flow__sleep {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}

.flow__sleep-val {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--blue);
}

.flow__section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 10px;
}

/* Flow Textarea */
.flow__textarea {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  outline: none;
  transition: border-color var(--transition);
}

.flow__textarea:focus {
  border-color: var(--accent);
}

/* Flow Navigation */
.flow__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.flow__nav .btn {
  min-width: 110px;
}

/* ===== Settings Overlay ===== */
.settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 350;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 0%, rgba(232, 115, 58, 0.06) 0%, transparent 50%),
                    radial-gradient(ellipse at 80% 100%, rgba(91, 138, 111, 0.05) 0%, transparent 50%);
  flex-direction: column;
}

.settings-overlay.active {
  display: flex;
}

.settings-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  flex-shrink: 0;
}

.settings-overlay__back {
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
}

.settings-overlay__title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
}

.settings-overlay__body {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 40px;
}

/* ===== Notes (Заметки) ===== */
.notes {
  padding-top: 12px;
}

.notes__period-tabs {
  display: flex;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 12px;
}

.notes__period-tab {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: none;
  border-radius: var(--radius-xs);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
}

.notes__period-tab.active {
  background: var(--surface1);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow);
}

.notes__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 4px;
}

.notes__nav-label {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
}

.notes__summary {
  padding: 16px 20px;
}

/* ===== Confirm Dialog ===== */
.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(45, 40, 32, 0.5);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.confirm-overlay.active {
  display: flex;
}

.confirm-dialog {
  background: var(--surface1);
  border-radius: var(--radius);
  padding: 24px;
  width: 280px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.confirm-dialog__text {
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.confirm-dialog__btns {
  display: flex;
  gap: 10px;
}

.confirm-dialog__btns .btn {
  flex: 1;
  padding: 10px 12px;
}

/* ===== Analytics ===== */
.analytics {
  padding-top: 12px;
}

.analytics__period-tabs {
  display: flex;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 14px;
}

.analytics__period-tab {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: none;
  border-radius: var(--radius-xs);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
}

.analytics__period-tab.active {
  background: var(--surface1);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow);
}

.analytics__empty {
  padding: 16px 0;
  text-align: center;
}

/* Trend Chart */
.trend-chart {
  min-height: 120px;
  display: flex;
  align-items: flex-end;
}

.trend-chart__bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 100%;
  height: 120px;
}

.trend-bar {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  min-width: 0;
}

.trend-bar__fill {
  width: 100%;
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  transition: height 0.3s ease;
}

.trend-bar__fill--red { background: var(--accent2); }
.trend-bar__fill--yellow { background: var(--gold); }
.trend-bar__fill--green { background: var(--accent3); }
.trend-bar__fill--blue { background: var(--blue); }

.trend-chart__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--muted);
}

.trend-chart__empty {
  text-align: center;
  padding: 20px 0;
}

/* Correlations */
.correlation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.correlation-item:last-child {
  border-bottom: none;
}

.correlation-item__left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.correlation-item__icon {
  font-size: 1.1rem;
}

.correlation-item__name {
  font-size: 0.9rem;
  font-weight: 500;
}

.correlation-item__right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.correlation-item__delta {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
}

.correlation--positive .correlation-item__delta {
  color: var(--accent3);
}

.correlation--negative .correlation-item__delta {
  color: var(--accent2);
}

.correlation-item__count {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Patterns */
.pattern-section__title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.pattern-bars {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 80px;
}

.pattern-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.pattern-bar {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}

.pattern-bar__fill {
  width: 100%;
  border-radius: 3px 3px 0 0;
  min-height: 0;
  transition: height 0.3s ease;
}

.pattern-bar__label {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 4px;
}

.pattern-insight {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.4;
}

.pattern-insight b {
  color: var(--text);
}

/* Time of day pattern */
.pattern-time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pattern-time-row__label {
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 85px;
  flex-shrink: 0;
}

.pattern-time-row__bar {
  flex: 1;
  height: 18px;
  background: var(--surface2);
  border-radius: 9px;
  overflow: hidden;
}

.pattern-time-row__fill {
  height: 100%;
  border-radius: 9px;
  transition: width 0.3s ease;
}

.pattern-time-row__val {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 28px;
  text-align: right;
}

/* Emotion Distribution */
.emotion-dist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.emotion-dist-row__name {
  font-size: 0.85rem;
  min-width: 90px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emotion-dist-row__bar {
  flex: 1;
  height: 18px;
  background: var(--surface2);
  border-radius: 9px;
  overflow: hidden;
}

.emotion-dist-row__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 9px;
  min-width: 4px;
  transition: width 0.3s ease;
}

.emotion-dist-row__val {
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 32px;
  text-align: right;
}

/* Year in Pixels */
.pixels__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
}

.pixels__months {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.pixels__month-name {
  font-size: 0.65rem;
  color: var(--muted);
  min-width: 28px;
  text-align: right;
}

.pixels__month-days {
  display: flex;
  gap: 1px;
  flex-wrap: nowrap;
}

.pixels__day {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.pixels__day--none { background: var(--surface3); }
.pixels__day--future { background: var(--surface2); }
.pixels__day--1 { background: var(--accent2); }
.pixels__day--4 { background: var(--gold); }
.pixels__day--6 { background: var(--accent3); }
.pixels__day--8 { background: var(--blue); }

.pixels__legend {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.pixels__legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--muted);
}

.pixels__dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.pixels__dot--1 { background: var(--accent2); }
.pixels__dot--4 { background: var(--gold); }
.pixels__dot--6 { background: var(--accent3); }
.pixels__dot--8 { background: var(--blue); }
.pixels__dot--none { background: var(--surface3); }

/* ===== Achievements ===== */
.achievements {
  padding-top: 12px;
}

/* Level card */
.achieve-level {
  text-align: center;
  padding: 24px 20px;
}

.achieve-level__icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.achieve-level__name {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}

.achieve-level__xp {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
}

.achieve-level__stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
}

.achieve-level__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.achieve-level__stat-val {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: white;
}

.achieve-level__stat-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
}

/* Badge grid */
.badge-counter {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
  text-align: center;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  text-align: center;
  opacity: 0.4;
  filter: grayscale(1);
  transition: all var(--transition);
}

.badge--unlocked {
  opacity: 1;
  filter: none;
  background: var(--surface1);
  box-shadow: var(--shadow);
}

.badge__icon {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.badge__name {
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 1.2;
}

.badge__desc {
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1.3;
}

.badge__date {
  font-size: 0.6rem;
  color: var(--accent3);
  margin-top: 4px;
}

/* Shop */
.shop-balance {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
  color: var(--gold);
}

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

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
}

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

.shop-item__icon {
  font-size: 1.5rem;
}

.shop-item__info {
  display: flex;
  flex-direction: column;
}

.shop-item__name {
  font-size: 0.85rem;
  font-weight: 600;
}

.shop-item__owned {
  font-size: 0.7rem;
  color: var(--muted);
}

.shop-item__buy {
  padding: 8px 14px;
  font-size: 0.8rem;
  min-width: 70px;
}

.shop-item__buy--disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== Settings Content ===== */
.settings-list__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.settings-list__item:last-child {
  border-bottom: none;
}

.settings-list__emoji {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
}

.settings-list__name {
  flex: 1;
  font-size: 0.9rem;
}

.settings-list__del {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--surface2);
  border-radius: 50%;
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.settings-list__del:active {
  background: var(--accent2);
  color: white;
}

.settings-add {
  display: flex;
  gap: 8px;
  align-items: center;
}

.settings-add__emoji {
  width: 44px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 1rem;
  text-align: center;
  background: var(--surface1);
  font-family: var(--font-body);
}

.settings-add__name {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  background: var(--surface1);
  font-family: var(--font-body);
}

.btn--sm {
  padding: 8px 14px;
  font-size: 0.85rem;
  min-width: auto;
}

/* Group editor */
.settings-group {
  margin-bottom: 18px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
}

.settings-group__header {
  margin-bottom: 10px;
}

.settings-group__name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-group__icon-input {
  width: 38px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 1.1rem;
  text-align: center;
  background: var(--surface1);
  font-family: var(--font-body);
}

.settings-group__name-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--surface1);
  font-family: var(--font-body);
}

.settings-group__del {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: all var(--transition);
}

.settings-group__del:active {
  opacity: 1;
}

/* Tag editor */
.settings-tag-section {
  margin-bottom: 16px;
}

.settings-tag-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.settings-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.settings-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: var(--surface2);
  border-radius: 50px;
  font-size: 0.8rem;
}

.settings-tag__del {
  width: 18px;
  height: 18px;
  border: none;
  background: var(--surface3);
  border-radius: 50%;
  font-size: 0.55rem;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
}

.settings-tag__del:active {
  background: var(--accent2);
  color: white;
}

.settings-tag-add {
  display: flex;
  gap: 8px;
}

.settings-tag-add input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  background: var(--surface1);
  font-family: var(--font-body);
}

/* Partner */
.partner-section {
  padding: 4px 0;
}

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

.partner-code__value {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
}

.partner-connect {
  display: flex;
  gap: 8px;
}

.partner-connect__input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 1rem;
  font-family: var(--font-body);
  letter-spacing: 2px;
  text-transform: uppercase;
  background: var(--surface1);
  text-align: center;
}

.partner-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.text-success {
  color: var(--accent3);
}

.text-danger {
  color: var(--accent2) !important;
}

/* Data buttons */
.settings-data-btns {
  padding: 4px 0;
}

/* ===== Polish & Animations ===== */

/* Pulse animation for add button */
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(232, 115, 58, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(232, 115, 58, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 115, 58, 0); }
}

.tab-bar__add {
  animation: pulse-ring 2.5s ease infinite;
}

/* Card entry animation */
.card {
  animation: fadeUp 0.3s ease both;
}

.entry-card {
  animation: fadeUp 0.25s ease both;
}

/* Stagger cards */
.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.1s; }
.card:nth-child(4) { animation-delay: 0.15s; }
.card:nth-child(5) { animation-delay: 0.2s; }

.entry-card:nth-child(2) { animation-delay: 0.05s; }
.entry-card:nth-child(3) { animation-delay: 0.1s; }
.entry-card:nth-child(4) { animation-delay: 0.15s; }

/* Flow overlay appear */
.flow-overlay.active .flow {
  animation: slideUp 0.3s ease;
}

/* Settings overlay appear */
.settings-overlay.active .settings-overlay__body {
  animation: fadeUp 0.25s ease;
}

/* Badge unlock shimmer */
.badge--unlocked {
  animation: popIn 0.3s ease both;
}

/* Smooth transitions for interactive elements */
.chip {
  transition: all 0.15s ease;
}

.chip:active {
  transform: scale(0.95);
}

.btn:active {
  transform: scale(0.97);
}

/* Result screen animation */
.save-result__emoji {
  animation: popIn 0.4s ease both;
}

.save-result__emotion {
  animation: fadeUp 0.4s ease 0.1s both;
}

.save-result__crystals {
  animation: fadeUp 0.4s ease 0.2s both;
}

/* Level progress bar animation */
.progress-bar__fill {
  transition: width 0.6s ease;
}

/* Trend bars animate in */
.trend-bar__fill {
  animation: growUp 0.4s ease both;
}

@keyframes growUp {
  from { height: 0 !important; }
}

/* Active tab indicator transition */
.tab-bar__btn {
  transition: color 0.2s ease;
}

/* Touch feedback for cards */
.entry-card:active {
  transform: scale(0.98);
  transition: transform 0.1s ease;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* ===== FULLSCREEN OVERLAYS (Morning, Evening, Situation) ===== */
.fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  max-width: 430px;
  left: 50%;
  margin-left: -215px;
}

@media (max-width: 430px) {
  .fullscreen-overlay {
    left: 0;
    margin-left: 0;
    max-width: 100%;
  }
}

.fullscreen-overlay.active {
  transform: translateX(0);
}

.fullscreen-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(245, 240, 232, 0.9);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.fullscreen-overlay__back {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
}

.fullscreen-overlay__title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.fullscreen-overlay__step {
  font-size: 0.8rem;
  color: var(--muted);
}

.fullscreen-overlay__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
}

/* ===== DAY NAVIGATION BAR ===== */
.day-nav {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.day-nav__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.day-nav__arrow {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition);
}

.day-nav__arrow:active {
  background: rgba(232, 115, 58, 0.1);
}

.day-nav__date {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
}

.day-nav__week {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.day-nav__day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border: none;
  background: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.day-nav__day:active {
  transform: scale(0.95);
}

.day-nav__day.selected {
  background: rgba(232, 115, 58, 0.12);
}

.day-nav__day.today .day-nav__day-num {
  color: var(--accent);
  font-weight: 700;
}

.day-nav__day-name {
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 500;
}

.day-nav__day-num {
  font-size: 0.9rem;
  font-weight: 600;
}

.day-nav__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
  transition: background var(--transition);
}

.day-nav__dot.visible {
  background: var(--accent);
}

.day-nav__day.selected .day-nav__dot.visible {
  background: var(--accent);
}

/* ===== DAY SCORE CARD ===== */
.day-score-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.day-score-card__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.day-score-card__score {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.day-score-card--red .day-score-card__score { color: var(--accent2); }
.day-score-card--gold .day-score-card__score { color: var(--gold); }
.day-score-card--green .day-score-card__score { color: var(--accent3); }
.day-score-card--blue .day-score-card__score { color: var(--blue); }

/* ===== DIARY ACCESS CARDS ===== */
.diary-cards-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.diary-card {
  flex: 1;
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
}

.diary-card:active {
  transform: scale(0.97);
  background: var(--surface2);
}

.diary-card__icon {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.diary-card__name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.diary-card__status {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 50px;
  background: var(--surface2);
}

.diary-card__status.filled {
  color: var(--accent3);
  background: rgba(91, 138, 111, 0.12);
  font-weight: 600;
}

/* ===== COLLAPSIBLE HINT ===== */
.collapsible-hint {
  background: rgba(91, 138, 111, 0.1);
  border: 1px solid rgba(91, 138, 111, 0.25);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 4px;
}

.collapsible-hint__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent3);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.collapsible-hint__body {
  padding: 0 16px 14px;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.6;
}

/* ===== AI PLACEHOLDER CARD ===== */
.ai-placeholder-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(147, 112, 219, 0.08);
  border: 1px solid rgba(147, 112, 219, 0.2);
  border-radius: var(--radius-sm);
  padding: 16px;
}

/* When used inside a .card wrapper */
.ai-placeholder-card.card {
  background: rgba(147, 112, 219, 0.08);
  border-color: rgba(147, 112, 219, 0.2);
}

.ai-placeholder__icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.ai-placeholder__title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #6B5BCD;
  margin-bottom: 4px;
}

.ai-placeholder__text {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ===== DIARY FIELDS ===== */
.diary-question {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.diary-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}

.diary-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface1);
  resize: none;
  transition: border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.diary-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== CBT SLIDER ===== */
.cbt-slider-block {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.cbt-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cbt-slider-value {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

.day-score-big {
  font-size: 2rem;
}

.cbt-range {
  width: 100%;
  margin: 4px 0;
  accent-color: var(--accent);
}

/* ===== EMOTION CATEGORY TABS ===== */
.emotion-cat-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.emotion-cat-tab {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 50px;
  background: var(--surface2);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.emotion-cat-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ===== EMOTION CHIPS ===== */
.emotion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.chip--sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text);
}

.chip--sm.selected {
  background: var(--accent3);
  color: white;
  border-color: var(--accent3);
}

.selected-emotions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* ===== COGNITIVE DISTORTIONS ===== */
.distortions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.distortion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface1);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition);
}

.distortion-item.selected {
  border-color: var(--accent3);
  background: rgba(91, 138, 111, 0.07);
}

.distortion-item__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  user-select: none;
}

.distortion-item__check {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.distortion-item__name {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
}

.distortion-item__toggle {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 6px;
  -webkit-tap-highlight-color: transparent;
}

.distortion-item__desc {
  padding: 0 14px 12px;
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ===== SITUATION SUMMARY ===== */
.situation-summary-card {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 18px;
}

.situation-summary__type {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.situation-summary__type.positive {
  background: rgba(91, 138, 111, 0.15);
  color: var(--accent3);
}

.situation-summary__type.negative {
  background: rgba(192, 99, 74, 0.12);
  color: var(--accent2);
}

.situation-summary__desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

.situation-summary__section {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ===== SITUATION CHOICE BUTTONS ===== */
.situation-choice-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius);
  text-align: left;
  background: var(--surface1);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-body);
  color: var(--text);
}

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

.situation-choice-btn--pos:active, .situation-choice-btn--pos:hover {
  border-color: var(--accent3);
  background: rgba(91, 138, 111, 0.08);
}

.situation-choice-btn--neg:active, .situation-choice-btn--neg:hover {
  border-color: var(--accent2);
  background: rgba(192, 99, 74, 0.08);
}

/* ===== CBT EMOTION INTENSITY ===== */
.cbt-emotion-intensity {
  background: var(--surface1);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  border: 1px solid var(--border);
}

/* ===== BOTTOM SHEET ===== */
.bottom-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(45, 40, 32, 0.45);
  z-index: 350;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.bottom-sheet-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 430px;
  background: var(--surface1);
  border-radius: var(--radius) var(--radius) 0 0;
  z-index: 360;
  padding: 0 16px;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -4px 24px rgba(45, 40, 32, 0.12);
}

.bottom-sheet.active {
  transform: translateX(-50%) translateY(0);
}

.bottom-sheet__handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 4px;
}

.bottom-sheet__title {
  text-align: center;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  padding: 8px 0 14px;
  color: var(--text);
}

.bottom-sheet__items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bottom-sheet__item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-body);
  text-align: left;
  width: 100%;
}

.bottom-sheet__item:active {
  background: var(--surface2);
}

.bottom-sheet__item-icon {
  font-size: 1.5rem;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.bottom-sheet__item-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

/* ===== PLAN CARDS ===== */
.plan-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px;
}

.plan-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  background: var(--surface1);
  transition: border-color var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.plan-card:active {
  background: var(--surface2);
}

.plan-card--mid {
  border-color: #C49A3C55;
  background: #FBF7ED;
}

.plan-card--mid:active {
  background: #F5EFD6;
}

.plan-card--premium {
  border-color: var(--accent);
  background: #FEF3EC;
}

.plan-card--premium:active {
  background: #FDEADC;
}

.plan-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.plan-card__name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.plan-card--mid .plan-card__name {
  color: var(--gold);
}

.plan-card--premium .plan-card__name {
  color: var(--accent);
}

.plan-card__price {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--font-body);
}

.plan-card__desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.plan-card--selected {
  border-color: var(--accent);
  background: rgba(91, 138, 111, 0.08);
}

.plan-card--mid.plan-card--selected {
  border-color: var(--gold);
  background: #F5EFD6;
}

.plan-card--premium.plan-card--selected {
  border-color: var(--accent);
  background: #FDEADC;
}

/* Бейдж плана в шапке чата */
.chat-plan-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
  background: var(--surface2);
  color: var(--muted);
}

.chat-plan-badge--mid {
  background: #FBF0D0;
  color: var(--gold);
}

.chat-plan-badge--premium {
  background: #FEE9D8;
  color: var(--accent);
}

/* ===== ANALYTICS NEW STATS ===== */
.analytics-avg-score-display {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 700;
  margin: 8px 0 4px;
  line-height: 1;
}

.analytics-situations-row {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.analytics-situations-item {
  flex: 1;
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.analytics-situations-item--pos {
  background: rgba(91, 138, 111, 0.12);
}

.analytics-situations-item--neg {
  background: rgba(192, 99, 74, 0.12);
}

.analytics-situations-count {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
}

.analytics-situations-item--pos .analytics-situations-count { color: var(--accent3); }
.analytics-situations-item--neg .analytics-situations-count { color: var(--accent2); }

.analytics-situations-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

/* Distortion stats */
.distortion-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.distortion-stat-row:last-child {
  border-bottom: none;
}

.distortion-stat-name {
  flex: 1;
  font-weight: 500;
}

.distortion-stat-count {
  font-weight: 700;
  color: var(--accent);
  background: rgba(232, 115, 58, 0.1);
  padding: 2px 10px;
  border-radius: 50px;
  font-size: 0.85rem;
}

/* ===== SETTINGS ADDITIONS ===== */
.settings-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface1);
  transition: border-color var(--transition);
}

.settings-input:focus {
  outline: none;
  border-color: var(--accent);
}

.settings-notif-info {
  background: rgba(196, 154, 60, 0.1);
  border: 1px solid rgba(196, 154, 60, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
}

.settings-notif-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.settings-notif-time {
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 1.05rem;
}

/* ===== LANGUAGE SWITCHER ===== */
.lang-switcher {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.lang-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn--active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.lang-btn:hover:not(.lang-btn--active) {
  border-color: var(--accent);
  background: var(--bg-secondary);
}

/* ===== UTILS (additional) ===== */
.mt-4 { margin-top: 4px; }

/* ===== ANIMATIONS ===== */
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100%); }
  to { transform: translateX(-50%) translateY(0); }
}


/* ===== Auth Screen ===== */
.auth-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 0%, rgba(232, 115, 58, 0.08) 0%, transparent 50%),
                    radial-gradient(ellipse at 80% 100%, rgba(91, 138, 111, 0.07) 0%, transparent 50%);
  overflow-y: auto;
  align-items: center;
  justify-content: center;
}

.auth-overlay.active {
  display: flex;
}

.auth-card {
  width: 100%;
  max-width: 390px;
  margin: auto;
  padding: 40px 28px 48px;
}

.auth-logo {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: center;
  margin-bottom: 6px;
  color: var(--text);
}

.auth-logo__accent {
  color: var(--accent);
}

.auth-tagline {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

.auth__tabs {
  display: flex;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 28px;
  gap: 4px;
}

.auth__tab {
  flex: 1;
  padding: 9px 0;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius-sm) - 3px);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.auth__tab.active {
  background: var(--surface1);
  color: var(--text);
  box-shadow: var(--shadow);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 10px;
  margin-bottom: 4px;
}

.auth-input {
  width: 100%;
  padding: 13px 16px;
  background: var(--surface1);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.auth-input:focus {
  border-color: var(--accent);
}

.auth-input-wrap {
  position: relative;
}

.auth-input-wrap .auth-input {
  padding-right: 46px;
}

.auth__eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px;
  color: var(--muted);
}

.auth__error {
  display: none;
  color: var(--accent2);
  font-size: 0.85rem;
  margin-top: 6px;
  padding: 10px 14px;
  background: rgba(192, 99, 74, 0.1);
  border-radius: var(--radius-xs);
}

.auth__submit {
  margin-top: 20px;
}

.auth__forgot {
  text-align: center;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

.auth__link {
  color: var(--accent);
  text-decoration: none;
}

/* ===== AI Analysis Bottom Sheet ===== */
.ai-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(45, 40, 32, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ai-backdrop.active { display: block; }

.ai-sheet {
  display: none;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  max-height: 80dvh;
  z-index: 501;
  background: var(--surface1);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -4px 32px rgba(45, 40, 32, 0.15);
  flex-direction: column;
  overflow: hidden;
}

.ai-sheet.active {
  display: flex;
  animation: slideUp 0.32s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.ai-sheet__handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}

.ai-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  flex-shrink: 0;
}

.ai-sheet__title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
}

.ai-sheet__close {
  background: var(--surface2);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 4px;
}

.ai-sheet__footer {
  padding: 12px 20px 28px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

/* Загрузка */
.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 0;
}

.ai-loading__pulse {
  font-size: 2rem;
  animation: aiPulse 1.2s ease-in-out infinite;
}

@keyframes aiPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.85); }
}

.ai-loading__text {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Результат */
.ai-result {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  padding-bottom: 8px;
}

/* Ошибка */
.ai-error {
  color: var(--accent2);
  font-size: 0.9rem;
  padding: 16px;
  background: rgba(192, 99, 74, 0.08);
  border-radius: var(--radius-sm);
  text-align: center;
}

/* Кнопка «Анализ от ИИ» */
.btn--ai {
  background: linear-gradient(135deg, #7B6FA0 0%, #5B7FA6 100%);
  color: #fff;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn--ai:active { opacity: 0.85; }

/* ===== AI Profile Screen ===== */
.ai-profile-loading,
.ai-profile-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  gap: 12px;
}

.ai-profile__card {
  margin-bottom: 0;
}

.ai-profile__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip--green {
  background: rgba(91, 138, 111, 0.15);
  color: var(--accent3);
}

.chip--red {
  background: rgba(192, 99, 74, 0.12);
  color: var(--accent2);
}

.chip--blue {
  background: rgba(91, 127, 166, 0.15);
  color: var(--blue);
}

.ai-profile__text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
}

.ai-profile__label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-profile__list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.ai-profile__meta {
  padding: 4px 0 24px;
}

/* ===== CHAT SCREEN ===== */

.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 450;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  max-width: 430px;
  left: 50%;
  margin-left: -215px;
}

@media (max-width: 430px) {
  .chat-overlay {
    left: 0;
    margin-left: 0;
    max-width: 100%;
  }
}

.chat-overlay.active {
  transform: translateX(0);
}

/* Шапка */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(245, 240, 232, 0.92);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.chat-header__back {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
}

.chat-header__title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  flex: 1;
  margin: 0 12px;
}

.chat-header__title span {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  font-family: var(--font-body);
  margin-top: 1px;
}

.chat-header__complete {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 10px;
  -webkit-tap-highlight-color: transparent;
}

.chat-header__complete:active {
  background: var(--surface2);
}

/* Область сообщений */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-messages::-webkit-scrollbar { display: none; }

/* Пузырьки */
.chat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-bubble--user {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.chat-bubble--assistant {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.chat-bubble--typing {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  padding: 12px 18px;
}

/* Анимация трёх точек */
.typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingDot 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40%            { opacity: 1;   transform: scale(1); }
}

/* Поле ввода */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface1);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  max-height: 120px;
  overflow-y: auto;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--accent);
}

.chat-input::-webkit-scrollbar { display: none; }

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.chat-send-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.chat-send-btn svg {
  fill: #fff;
  width: 18px;
  height: 18px;
}

/* Экран саммари */
.chat-summary {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-summary__title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.chat-summary__text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface1);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--border);
}

.chat-summary__section-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}

.chat-summary__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-summary__item {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: var(--radius-xs);
}

.chat-summary__item::before {
  content: '→ ';
  color: var(--accent);
  font-weight: 600;
}

/* Оценка сессии */
.chat-rating {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.chat-rating__btn {
  flex: 1;
  padding: 12px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface1);
  font-size: 1.3rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.chat-rating__btn span {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--font-body);
}

.chat-rating__btn.selected,
.chat-rating__btn:active {
  border-color: var(--accent);
  background: var(--surface2);
}

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

/* Панель возобновления сессии */
.chat-reopen-bar {
  padding: 12px 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Компактное саммари внутри истории сообщений */
.chat-completed-summary {
  margin: 8px 0;
  padding: 14px 16px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-completed-summary__title {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.chat-completed-summary__text {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
}

.chat-completed-summary__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-top: 4px;
}

.chat-completed-summary__item {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text);
}

/* ===== SESSIONS SCREEN ===== */

.sessions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 12px;
}

.sessions-header__title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.sessions-header__new {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px 100px;
}

.session-card {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.session-card:active {
  background: var(--surface2);
  transform: scale(0.985);
}

.session-card__top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.session-card__date {
  font-size: 0.8rem;
  color: var(--muted);
}

.session-card__badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.session-card__badge--active {
  background: rgba(91, 138, 111, 0.15);
  color: var(--accent3);
}

.session-card__badge--done {
  background: var(--surface2);
  color: var(--muted);
}

.session-card__source {
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 5px;
}

.session-card__preview {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 6px;
}

.session-card__meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.session-card__delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
  opacity: 0.5;
  margin-left: auto;
  line-height: 1;
  flex-shrink: 0;
}

.session-card__delete:active {
  opacity: 1;
}

.session-card--skeleton {
  height: 90px;
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.4s infinite;
  cursor: default;
}

@keyframes skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.sessions-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 32px;
  gap: 12px;
}

.sessions-empty__icon {
  font-size: 3rem;
}

.sessions-empty__text {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ===== ADMIN PANEL ===== */

.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: var(--surface, #fff);
  overflow-x: auto;
  flex-shrink: 0;
}

.admin-tab-btn {
  flex: 1;
  min-width: 80px;
  padding: 0.75rem 0.5rem;
  border: none;
  background: none;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted, #718096);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.admin-tab-btn.active {
  color: var(--accent, #805ad5);
  border-bottom-color: var(--accent, #805ad5);
}

.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.admin-tab-pane {
  display: none;
}

.admin-tab-pane.active {
  display: block;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.admin-stat-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 0.875rem;
  text-align: center;
}

.admin-stat-label {
  font-size: 0.75rem;
  color: var(--muted, #718096);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.admin-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text, #1a202c);
}

.admin-section {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.admin-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text, #1a202c);
  margin-bottom: 0.25rem;
}

.admin-section-desc {
  font-size: 0.8rem;
  color: var(--muted, #718096);
  margin-bottom: 0.75rem;
}

.admin-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary, #4a5568);
  margin-bottom: 0.25rem;
  margin-top: 0.5rem;
}

.admin-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-size: 0.875rem;
  background: var(--bg, #f7fafc);
  color: var(--text, #1a202c);
  box-sizing: border-box;
}

.admin-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-size: 0.8rem;
  background: var(--bg, #f7fafc);
  color: var(--text, #1a202c);
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
}

.admin-save-btn {
  width: 100%;
  margin-top: 1rem;
}

.admin-save-status {
  text-align: center;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  min-height: 1.25rem;
}

.admin-save-status--ok  { color: #38a169; }
.admin-save-status--err { color: #e53e3e; }

.admin-cost-group {
  margin-bottom: 1.25rem;
}

.admin-cost-group-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text, #1a202c);
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.admin-cost-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.admin-cost-label {
  flex: 1;
  font-size: 0.825rem;
  color: var(--text-secondary, #4a5568);
}

.admin-cost-input {
  width: 90px;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-size: 0.875rem;
  background: var(--bg, #f7fafc);
  text-align: right;
}

.admin-radio-group {
  display: flex;
  gap: 1.25rem;
  margin: 0.5rem 0 0.75rem;
  font-size: 0.875rem;
}

.admin-radio-group label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.admin-date-row {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
}

.admin-date-row > div {
  flex: 1;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  overflow-x: auto;
  display: block;
}

.admin-table th, .admin-table td {
  padding: 0.5rem 0.625rem;
  text-align: left;
  border-bottom: 1px solid var(--border, #e2e8f0);
  white-space: nowrap;
}

.admin-table th {
  font-weight: 600;
  color: var(--muted, #718096);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-td-desc {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-loading, .admin-empty {
  text-align: center;
  color: var(--muted, #718096);
  padding: 2rem;
  font-size: 0.875rem;
}

.admin-error {
  color: #e53e3e;
  padding: 1rem;
  font-size: 0.875rem;
}

.admin-refresh-btn {
  display: block;
  margin: 0 auto;
}

.btn--xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.btn--danger {
  background: #e53e3e;
  color: #fff;
  border-color: #e53e3e;
}

#adminOverlay .fullscreen-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
}

#adminOverlay {
  display: flex;
  flex-direction: column;
}

#adminLoginScreen,
#adminMainScreen {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.admin-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border, #e2e8f0);
  border-top-color: var(--color-primary, #6366f1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ===== DateTime Picker (dtp-picker) ===== */
.dtp-picker {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.dtp-picker__fields {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.dtp-picker__field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dtp-picker__label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.dtp-picker__input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.dtp-picker__input:focus {
  border-color: var(--accent);
}

.dtp-picker__now {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 6px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}

.dtp-picker__now:active {
  background: var(--surface2);
  color: var(--text);
}

/* Time input в flow (запись настроения) */
.flow__time-input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface1);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
}

.flow__time-input:focus {
  border-color: var(--accent);
}

.flow__date-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== QUICK MOOD SELECTOR ===== */
.quick-mood {
  padding: 16px 20px 18px;
  margin-bottom: 14px;
}

.quick-mood__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 14px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quick-mood__smileys {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.quick-mood__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px;
  border: none;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.quick-mood__btn:active {
  transform: scale(0.93);
  background: rgba(232, 115, 58, 0.15);
}

.quick-mood__emoji {
  font-size: 1.65rem;
  line-height: 1;
}

.quick-mood__label {
  font-size: 0.67rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

/* ===== DAY DIVIDER ===== */
.day-divider {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}

.day-divider::before,
.day-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border));
}

.day-divider::after {
  background: linear-gradient(90deg, var(--border), transparent);
}

.day-divider__text {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  padding: 4px 10px;
  background: var(--surface2);
  border-radius: 50px;
}

/* ===== DAY RECORDS CARDS ===== */
.day-records-card {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.day-records-card--clickable {
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.day-records-card--clickable:active {
  transform: scale(0.98);
  background: var(--surface2);
}

.day-records-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.day-records-card__icon-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-records-card__icon {
  font-size: 1.2rem;
}

.day-records-card__title {
  font-weight: 700;
  font-size: 0.95rem;
}

.day-records-card__count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.day-records-card__preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.day-records-card__preview-item {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--surface2);
  border-radius: 50px;
  padding: 4px 10px;
  font-size: 0.88rem;
}

.day-records-card__preview-score {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  margin-left: 2px;
}

.day-records-card__preview-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.day-records-card__preview-line {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.4;
}

.day-records-card__preview-emotions {
  font-size: 0.82rem;
  color: var(--muted);
}

.day-records-card__empty {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.day-records-card__add-btn {
  margin-top: 8px;
}

.day-records-card__add-btn--positive {
  background: rgba(91, 138, 111, 0.15);
  color: var(--accent3);
  border: 1px solid rgba(91, 138, 111, 0.3);
}

.day-records-card__add-btn--negative {
  background: rgba(192, 99, 74, 0.1);
  color: var(--accent2);
  border: 1px solid rgba(192, 99, 74, 0.25);
}

/* ===== SUBSCREEN ENTRIES ===== */
.subscreen-desc {
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.subscreen-entry {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.subscreen-entry:last-of-type {
  border-bottom: none;
}

.subscreen-entry--positive {
  border-left: 3px solid var(--accent3);
  padding-left: 12px;
}

.subscreen-entry--negative {
  border-left: 3px solid var(--accent2);
  padding-left: 12px;
}

.subscreen-entry__time {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 36px;
  padding-top: 2px;
}

.subscreen-entry__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.subscreen-entry__emotion {
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.subscreen-entry__score {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(232, 115, 58, 0.1);
  padding: 2px 7px;
  border-radius: 50px;
}

.subscreen-entry__text {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
}

.subscreen-entry__tags {
  font-size: 0.78rem;
  color: var(--muted);
}

.subscreen-entry__reframe {
  font-size: 0.82rem;
  color: var(--accent3);
  background: rgba(91, 138, 111, 0.08);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  line-height: 1.4;
}

.subscreen-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 24px 0 8px;
}

.subscreen-add-btn {
  margin-top: 20px;
  margin-bottom: 8px;
}

/* ===== DIARY VIEW (read-only) ===== */
.diary-view-score {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 16px;
  text-align: center;
}

.diary-view-score__val {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.diary-view-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.diary-view-item:last-of-type {
  border-bottom: none;
}

.diary-view-item__q {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.diary-view-item__a {
  font-size: 0.93rem;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
}

.subscreen-diary-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-bottom: 8px;
}


/* ===== Voice Recorder ===== */

/* ── Toast ── */
.voice-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--surface1);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 24px;
  font-size: .88rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  white-space: nowrap;
  max-width: 90vw;
}
.voice-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.voice-toast--success { background: #4caf50; color: #fff; }
.voice-toast--error   { background: #e53935; color: #fff; }

/* ── Inline mic (entry form & chat) ── */
/* Контейнер кнопки в форме записи */
.flow__mic-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

/* Контейнер кнопки в чате */
#chatMicBtnWrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Общая кнопка */
.mic-inline-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mic-inline-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface2);
  color: var(--text-secondary);
  font-size: .82rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.mic-inline-btn:hover {
  background: var(--border);
  color: var(--text);
}
.mic-inline-btn--recording {
  background: #e53935;
  border-color: #e53935;
  color: #fff;
}
.mic-inline-btn:disabled {
  opacity: .6;
  cursor: default;
}
.mic-inline-label {
  line-height: 1;
}
.mic-inline-timer {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 28px;
}
.mic-inline-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: voice-spin .7s linear infinite;
  flex-shrink: 0;
}

/* Chat — кнопка в нижней панели */
#chatMicBtnWrap .mic-inline-btn {
  height: 36px;
  padding: 0 12px 0 10px;
  border-radius: 18px;
}

/* ── Voice Note Bottom Sheet ── */
.voice-sheet__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.voice-sheet__backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.voice-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface1);
  border-radius: 20px 20px 0 0;
  z-index: 1101;
  padding: 0 20px 40px;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  max-height: 88vh;
  overflow-y: auto;
}
.voice-sheet.active {
  transform: translateY(0);
}

.voice-sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 10px auto 18px;
}
.voice-sheet__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 20px;
}

/* Запись */
.voice-sheet__viz {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
  height: 60px;
}
.voice-sheet__pulse {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  animation: vPulseDot 1.2s ease-in-out infinite;
}
.voice-sheet__pulse--2 { width: 26px; height: 26px; animation-delay: .2s; }
.voice-sheet__pulse--3 { animation-delay: .4s; }
.voice-sheet__viz--paused .voice-sheet__pulse {
  animation-play-state: paused;
  opacity: .4;
}
@keyframes vPulseDot {
  0%, 100% { transform: scale(1); opacity: .8; }
  50%       { transform: scale(1.4); opacity: 1; }
}

.voice-sheet__timer {
  text-align: center;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .04em;
  margin-bottom: 28px;
}

.voice-sheet__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 18px;
}
.voice-sheet__pause-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.voice-sheet__pause-btn:active { background: var(--border); }
.voice-sheet__stop-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: none;
  background: #e53935;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(229,57,53,.35);
  -webkit-tap-highlight-color: transparent;
}

.voice-sheet__cancel {
  display: block;
  margin: 4px auto 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: .88rem;
  cursor: pointer;
  padding: 8px 20px;
  -webkit-tap-highlight-color: transparent;
}

/* Spinner */
.voice-sheet__spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 110px;
}
.voice-sheet__spinner {
  width: 42px;
  height: 42px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: voice-spin .8s linear infinite;
}
@keyframes voice-spin {
  to { transform: rotate(360deg); }
}

/* Результат */
.voice-sheet__textarea {
  width: 100%;
  min-height: 100px;
  max-height: 260px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: .93rem;
  color: var(--text);
  background: var(--surface2);
  resize: none;
  font-family: var(--font-body);
  line-height: 1.5;
  box-sizing: border-box;
  outline: none;
  transition: border-color .2s;
}
.voice-sheet__textarea:focus { border-color: var(--accent); }

.voice-sheet__duration {
  text-align: right;
  color: var(--text-secondary);
  font-size: .78rem;
  margin: 4px 0 14px;
}
.voice-sheet__actions {
  display: flex;
  gap: 10px;
}
.voice-sheet__actions .btn { flex: 1; }
.voice-sheet__add-mood {
  text-align: center;
  color: var(--accent);
  font-size: .85rem;
  margin-top: 14px;
  cursor: pointer;
  padding: 8px;
}

/* Tab-bar центральная иконка */
.tab-bar__mic-icon {
  width: 26px;
  height: 26px;
}

/* Карточки голосовых заметок в истории */
.entry-card--voice {
  border-left: 3px solid var(--accent);
}
.entry-card__score--dim {
  color: var(--text-secondary);
  font-size: .78rem;
  font-weight: 500;
}
