:root {
  --bg: var(--tg-theme-bg-color, #faf7f0);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f0ecdf);
  --text: var(--tg-theme-text-color, #2b2b28);
  --hint: var(--tg-theme-hint-color, #8a8578);
  --link: var(--tg-theme-link-color, #2b2b28);
  --button-bg: var(--tg-theme-button-color, #dcd52c);
  --button-text: var(--tg-theme-button-text-color, #2b2b28);
  --accent: #dcd52c;
  --danger: #c0392b;
  --card-bg: var(--tg-theme-section-bg-color, #ffffff);
  --border: rgba(43, 43, 40, 0.1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Golos Text", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  padding: 16px 16px 32px;
}

#loading, .empty-state, .error-state {
  text-align: center;
  color: var(--hint);
  padding: 48px 16px;
  font-size: 15px;
}

.header {
  margin-bottom: 20px;
}

.header h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
}

.header .subtitle {
  color: var(--hint);
  font-size: 14px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--hint);
  margin: 20px 0 8px;
}

.section-title.overdue {
  color: var(--danger);
}

.task-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.task-card .row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.task-card .task-id {
  font-size: 11px;
  color: var(--hint);
  font-weight: 600;
}

.task-card .task-title {
  font-size: 15px;
  font-weight: 500;
  margin: 2px 0 8px;
}

.task-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--hint);
}

.task-card .due-date.overdue {
  color: var(--danger);
  font-weight: 600;
}

.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--secondary-bg);
  color: var(--text);
}

.status-pill.status-not_started { background: var(--secondary-bg); }
.status-pill.status-in_progress { background: #fdf0a8; }
.status-pill.status-in_review { background: #cfe8ff; }
.status-pill.status-done { background: #d3f0c8; }
.status-pill.status-cancelled { background: #e6e2d6; color: var(--hint); }

/* Экран задачи */
.task-detail {
  padding-bottom: 24px;
}

.back-button {
  background: none;
  border: none;
  color: var(--link);
  font-size: 15px;
  padding: 8px 0;
  margin-bottom: 12px;
  cursor: pointer;
}

.field {
  margin-bottom: 16px;
}

.field-label {
  font-size: 12px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.field-value {
  font-size: 15px;
  line-height: 1.4;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tag {
  font-size: 12px;
  background: var(--secondary-bg);
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--hint);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--button-bg);
  color: var(--button-text);
}

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

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.confirm-toast {
  position: fixed;
  bottom: 24px;
  left: 16px;
  right: 16px;
  background: var(--accent);
  color: #2b2b28;
  padding: 12px 16px;
  border-radius: 12px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}

/* Все задачи */
.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
  padding-bottom: 4px;
}

.filters select {
  flex: 1;
  min-width: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}

.counters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.counter {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}

.counter .value {
  font-size: 18px;
  font-weight: 700;
}

.counter .label {
  font-size: 11px;
  color: var(--hint);
  margin-top: 2px;
}

/* Команда */
.team-row {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.team-row .name {
  font-weight: 500;
  font-size: 14px;
}

.team-row .direction {
  color: var(--hint);
  font-size: 12px;
}

.team-row .stats {
  text-align: right;
  font-size: 12px;
  color: var(--hint);
}

.team-row .stats .overdue-count {
  color: var(--danger);
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--secondary-bg);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
}

.tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--hint);
  cursor: pointer;
}

.tabs button.active {
  background: var(--card-bg);
  color: var(--text);
}

/* Шапка */
.app-header {
  margin-bottom: 16px;
}

.app-header-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.app-header-title {
  font-size: 14px;
  color: var(--hint);
}

.app-header-name {
  font-size: 15px;
  font-weight: 600;
}

.app-header-sub {
  font-size: 12px;
  color: var(--hint);
  margin-top: 2px;
}

.counter.counter-danger .value {
  color: var(--danger);
}

/* Главное меню */
.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-btn {
  text-align: left;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}

/* Команда */
.role-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--hint);
}

.tg-link {
  font-size: 13px;
  color: var(--link);
  text-decoration: none;
  white-space: nowrap;
}

/* Календарь */
.calendar-pinned {
  margin-bottom: 16px;
}

.calendar-entry {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--hint);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.calendar-entry.cal-event { border-left-color: var(--accent); }
.calendar-entry.cal-deadline { border-left-color: var(--danger); }
.calendar-entry.cal-partner { border-left-color: #8a8fd6; }

.calendar-entry-date {
  font-size: 12px;
  color: var(--hint);
  font-weight: 600;
  text-transform: uppercase;
}

.calendar-entry-title {
  font-size: 15px;
  margin-top: 2px;
}

.calendar-entry-comment {
  font-size: 12px;
  color: var(--hint);
  margin-top: 4px;
}

/* Тексты (о проекте / как мы работаем) */
.text-screen {
  font-size: 15px;
  line-height: 1.5;
}

.text-screen p {
  margin: 0 0 12px;
}

.text-list {
  margin: 0 0 12px;
  padding-left: 20px;
}

.text-list li {
  margin-bottom: 6px;
}

/* Мои баллы */
.score-big {
  font-size: 48px;
  font-weight: 700;
  text-align: center;
  margin: 16px 0 4px;
}

.score-next {
  text-align: center;
  color: var(--hint);
  font-size: 13px;
  margin-bottom: 16px;
}

.reward-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.reward-row.achieved {
  border-color: var(--accent);
}

.reward-threshold {
  font-weight: 700;
  font-size: 14px;
  min-width: 44px;
}

.reward-description {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}

.reward-check {
  color: var(--accent);
  font-weight: 700;
  font-size: 16px;
}

/* Материалы */
.material-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
}

.material-row.disabled {
  color: var(--hint);
}

.material-row .soon {
  font-size: 11px;
  color: var(--hint);
}
