/**
 * Мои задачи — компактный интерфейс со статус-фильтрами
 */

.mt-page {
  background: var(--m657-bg-page);
  min-height: calc(100vh - var(--m657-layout-header-height));
}

/* ── Compact summary strip ── */
.mt-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--m657-border) 45%, #fff);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.mt-summary-xp {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.mt-summary-xp-value {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--m657-gold);
  line-height: 1;
}

.mt-summary-xp-label {
  font-size: 0.8125rem;
  color: var(--m657-text-muted);
}

.mt-summary-level {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.8125rem;
  color: var(--m657-text-secondary);
}

.mt-summary-level strong {
  font-family: 'Montserrat', sans-serif;
  color: var(--m657-blue);
}

.mt-summary-level-bar {
  width: 64px;
  height: 4px;
  background: var(--m657-bg-muted);
  border-radius: 999px;
  overflow: hidden;
}

.mt-summary-level-fill {
  height: 100%;
  background: var(--m657-blue);
  border-radius: 999px;
}

/* ── Status filter bar — главный способ навигации ── */
.mt-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--m657-border) 35%, #fff);
}

.mt-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border: 1.5px solid color-mix(in srgb, var(--m657-border) 50%, #fff);
  border-radius: 999px;
  background: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--m657-text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}

.mt-filter:hover {
  border-color: var(--m657-blue-muted);
  color: var(--m657-text);
}

.mt-filter.active {
  background: var(--m657-blue);
  border-color: var(--m657-blue);
  color: #fff;
}

.mt-filter.active .mt-filter-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.mt-filter:focus-visible {
  outline: 2px solid var(--m657-blue);
  outline-offset: 2px;
}

.mt-filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mt-filter-dot--overdue { background: var(--m657-status-attention); }
.mt-filter-dot--in_progress { background: var(--m657-status-ok); }
.mt-filter-dot--awaiting { background: var(--m657-gold-muted); }
.mt-filter-dot--planned { background: var(--m657-blue-muted); }
.mt-filter-dot--done { background: var(--m657-text-muted); }

.mt-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.625rem;
  font-weight: 700;
  background: var(--m657-bg-page);
  color: var(--m657-text-muted);
}

.mt-filter.active.mt-filter--overdue {
  background: var(--m657-status-attention);
  border-color: var(--m657-status-attention);
}

.mt-filter.active.mt-filter--in_progress {
  background: var(--m657-status-ok);
  border-color: var(--m657-status-ok);
}

.mt-filter.active.mt-filter--awaiting {
  background: var(--m657-gold-muted);
  border-color: var(--m657-gold-muted);
  color: #fff;
}

/* ── Toolbar row ── */
.mt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.mt-view-switch {
  display: inline-flex;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--m657-border) 45%, #fff);
  border-radius: 8px;
  padding: 2px;
}

.mt-view-switch button {
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 0.3125rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--m657-text-muted);
  cursor: pointer;
}

.mt-view-switch button.active {
  background: var(--m657-bg-page);
  color: var(--m657-blue);
}

.mt-toolbar-add {
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.375rem 0.875rem;
}

/* ── Empty filter state ── */
.mt-empty-filter {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--m657-text-muted);
  font-size: 0.875rem;
}

.mt-empty-filter[hidden] {
  display: none !important;
}

/* ── Section (timeline lite) ── */
.mt-section {
  margin-bottom: 1.5rem;
}

.mt-section[hidden] {
  display: none !important;
}

.mt-section-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
}

.mt-section-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--m657-text-muted);
  margin: 0;
}

.mt-section-count {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--m657-text-muted);
  opacity: 0.7;
}

.mt-section--overdue .mt-section-title { color: var(--m657-status-attention); }

/* ── Task cards: grid left-to-right within each group ── */
.mt-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.625rem;
}

@media (min-width: 768px) {
  .mt-list {
    grid-template-columns: repeat(auto-fill, minmax(12rem, 14.5rem));
  }
}

@media (min-width: 1200px) {
  .mt-list {
    grid-template-columns: repeat(auto-fill, minmax(12.5rem, 15rem));
  }
}

.mt-row {
  --mt-sphere: var(--m657-blue);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: color-mix(in srgb, var(--mt-sphere) 4%, #fff);
  border: 1px solid color-mix(in srgb, var(--mt-sphere) 18%, var(--m657-border));
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  min-height: 6.75rem;
  width: 100%;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}

.mt-row[hidden] {
  display: none !important;
}

.mt-row:hover {
  box-shadow: 0 3px 12px rgba(18, 30, 44, 0.08);
  border-color: color-mix(in srgb, var(--mt-sphere) 35%, #fff);
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .mt-row:hover { transform: none; }
}

.mt-row.m657-sphere-intellectual { --mt-sphere: var(--m657-sphere-intellectual); }
.mt-row.m657-sphere-volunteer { --mt-sphere: var(--m657-sphere-volunteer); }
.mt-row.m657-sphere-creative { --mt-sphere: var(--m657-sphere-creative); }
.mt-row.m657-sphere-sport { --mt-sphere: var(--m657-sphere-sport); }
.mt-row.m657-sphere-career { --mt-sphere: var(--m657-sphere-career); }
.mt-row.m657-sphere-civic { --mt-sphere: var(--m657-sphere-civic); }
.mt-row.m657-sphere-behavior { --mt-sphere: var(--m657-sphere-behavior); }

.mt-row.is-done { opacity: 0.65; }
.mt-row.is-done .mt-row-title { text-decoration: line-through; color: var(--m657-text-muted); }

/* Stripe = sphere color, top bar on tile */
.mt-row-stripe {
  width: 100%;
  height: 4px;
  flex-shrink: 0;
  background: var(--mt-sphere);
  border-radius: 12px 12px 0 0;
  margin: 0;
}

.mt-row-content {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0.625rem 0.625rem;
  flex: 1;
  min-width: 0;
  position: relative;
}

.mt-row-sphere {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mt-sphere);
  white-space: nowrap;
  width: auto;
  padding-right: 3.25rem;
}

.mt-row-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--m657-text);
  margin: 0;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

.mt-row-meta {
  font-size: 0.625rem;
  color: var(--m657-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mt-row-xp {
  position: absolute;
  top: 0.5rem;
  right: 0.625rem;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--m657-gold);
  white-space: nowrap;
  padding: 0.15rem 0.4rem;
  background: color-mix(in srgb, var(--m657-gold) 12%, #fff);
  border-radius: 5px;
}

.mt-row-xp.is-partial {
  color: var(--mt-sphere);
  background: color-mix(in srgb, var(--mt-sphere) 10%, #fff);
}

.mt-row-xp.is-earned {
  color: var(--m657-status-ok);
  background: color-mix(in srgb, var(--m657-status-ok) 10%, #fff);
}

/* Status badge */
.mt-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  line-height: 1.3;
  white-space: nowrap;
}

.mt-badge--overdue {
  color: var(--m657-status-attention);
  background: color-mix(in srgb, var(--m657-status-attention) 12%, #fff);
}

.mt-badge--in_progress {
  color: var(--m657-status-ok);
  background: color-mix(in srgb, var(--m657-status-ok) 12%, #fff);
}

.mt-badge--awaiting {
  color: #8A6520;
  background: color-mix(in srgb, var(--m657-gold) 14%, #fff);
}

.mt-badge--planned {
  color: var(--m657-blue);
  background: color-mix(in srgb, var(--m657-blue) 10%, #fff);
}

.mt-badge--done {
  color: var(--m657-status-ok);
  background: color-mix(in srgb, var(--m657-status-ok) 10%, #fff);
}

/* Progress inside tile */
.mt-row-progress {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  width: 100%;
}

.mt-row-progress-track {
  flex: 1;
  height: 4px;
  background: var(--m657-bg-muted);
  border-radius: 999px;
  overflow: hidden;
}

.mt-row-progress-fill {
  height: 100%;
  background: var(--mt-sphere);
  border-radius: 999px;
}

.mt-row-progress-text {
  font-size: 0.625rem;
  color: var(--m657-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.mt-row-action {
  margin-top: auto;
  padding-top: 0.25rem;
  width: 100%;
}

.mt-row-action .btn {
  width: 100%;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.3125rem 0.5rem;
  border-radius: 7px;
  white-space: nowrap;
}

.mt-btn-sm-awaiting,
.mt-btn-sm-done {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.625rem;
  padding: 0.3125rem 0.5rem;
  border-radius: 7px;
}

.mt-btn-sm-awaiting {
  background: color-mix(in srgb, var(--m657-gold) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--m657-gold-muted) 30%, #fff);
  color: var(--m657-gold);
  cursor: default;
}

.mt-btn-sm-done {
  background: color-mix(in srgb, var(--m657-status-ok) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--m657-status-ok) 25%, #fff);
  color: var(--m657-status-ok);
  cursor: default;
}

@media (max-width: 767.98px) {
  .mt-list {
    grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  }
}

/* ── Done collapsed ── */
.mt-done-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border: 1px dashed color-mix(in srgb, var(--m657-border) 60%, #fff);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--m657-text-muted);
  text-align: left;
}

.mt-done-trigger .chevron {
  margin-left: auto;
  font-size: 0.6875rem;
  transition: transform 0.2s;
}

.mt-done-trigger.expanded .chevron { transform: rotate(180deg); }

/* ── Sphere view ── */
.mt-sphere-block {
  margin-bottom: 1.5rem;
}

.mt-sphere-head {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
}

.mt-sphere-block.m657-sphere-intellectual { --mt-sphere: var(--m657-sphere-intellectual); }
.mt-sphere-block.m657-sphere-volunteer { --mt-sphere: var(--m657-sphere-volunteer); }
.mt-sphere-block.m657-sphere-creative { --mt-sphere: var(--m657-sphere-creative); }
.mt-sphere-block.m657-sphere-sport { --mt-sphere: var(--m657-sphere-sport); }
.mt-sphere-block.m657-sphere-career { --mt-sphere: var(--m657-sphere-career); }
.mt-sphere-block.m657-sphere-behavior { --mt-sphere: var(--m657-sphere-behavior); }
.mt-sphere-block.m657-sphere-civic { --mt-sphere: var(--m657-sphere-civic); }

.mt-sphere-icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--mt-sphere);
  background: color-mix(in srgb, var(--mt-sphere) 12%, #fff);
}

.mt-sphere-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--mt-sphere);
  margin: 0;
}

.mt-sphere-xp-summary {
  font-size: 0.6875rem;
  color: var(--m657-text-muted);
  margin: 0;
}

#view-by-sphere { display: none; }
#view-by-sphere.visible { display: block; }
#view-by-time.hidden { display: none; }

/* ── FAB ── */
.mt-fab {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--m657-blue);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(40, 69, 88, 0.3);
  font-size: 1.125rem;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1040;
  cursor: pointer;
}

@media (max-width: 767.98px) {
  .mt-fab { display: inline-flex; }
  .mt-toolbar-add { display: none; }
}

/* ── Drawer ── */
.mt-drawer-xp {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--m657-gold);
}

/* ── Toast ── */
@keyframes mt-xp-pop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.mt-xp-toast {
  position: fixed;
  bottom: 4.5rem;
  right: 1.25rem;
  z-index: 9999;
  background: var(--m657-gold-muted);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.9375rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(154, 112, 40, 0.35);
  animation: mt-xp-pop 0.3s ease forwards;
}

@media (prefers-reduced-motion: reduce) {
  .mt-xp-toast { animation: none; }
}
