:root {
  --bg: #ffffff;
  --grid: #f4f4f0;
  --secondary-bg: #f4f4f0;
  --text: #2a2a28;
  --hint: #8f8d80;
  --link: #2a2a28;
  --button-bg: #dbd42b;
  --button-text: #2a2a28;
  --accent: #dbd42b;
  --accent-text: #b8a400;
  --danger: #c0392b;
  --card-bg: #ffffff;
  --border: rgba(42, 42, 40, 0.18);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  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: 21px;
  font-weight: 900;
  text-transform: uppercase;
  margin: 0 0 4px;
}

.section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hint);
  margin: 20px 0 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

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

.task-card {
  background: var(--card-bg);
  border-radius: 0;
  padding: 14px;
  margin-bottom: 8px;
  border: 2px 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: 700;
}

.stage-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  color: var(--text);
  background: var(--accent);
  padding: 2px 7px;
  margin-left: 8px;
  vertical-align: middle;
}

.task-card .task-title {
  font-size: 15px;
  font-weight: 700;
  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: 700;
}

.task-card-reviewer {
  font-size: 12px;
  color: var(--hint);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  background: transparent;
  border: 2px solid var(--text);
  color: var(--text);
}

.status-pill.status-not_started { border-color: var(--text); color: var(--text); }
.status-pill.status-in_progress { border-color: var(--accent-text); color: var(--accent-text); }
.status-pill.status-in_review { border-color: var(--accent-text); color: var(--accent-text); }
.status-pill.status-done { border-color: var(--hint); color: var(--hint); }
.status-pill.status-cancelled { border-color: var(--hint); color: var(--hint); }

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

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

.field {
  margin-bottom: 16px;
}

.field-label {
  font-size: 11px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  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;
  color: var(--hint);
  font-weight: 700;
}

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

.btn {
  border: 2.5px solid var(--text);
  padding: 14px;
  font-size: 15px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  background: var(--button-bg);
  color: var(--button-text);
}

.confirm-toast {
  position: fixed;
  bottom: 24px;
  left: 16px;
  right: 16px;
  background: var(--text);
  color: #fff;
  padding: 12px 16px;
  text-align: center;
  font-weight: 700;
  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: 2px solid var(--border);
  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: 2px solid var(--border);
  padding: 10px;
  text-align: center;
}

.counter .value {
  font-size: 19px;
  font-weight: 900;
}

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

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

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

.team-row .name {
  font-weight: 700;
  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: 700;
}

.role-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--hint);
}

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

/* Общий значок-бейдж со счётчиком (footer-меню, выпадашка, гамбургер) */
.badge {
  background: var(--accent);
  color: var(--text);
  font-size: 10px;
  font-weight: 900;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--text);
}

/* Шапка главного экрана */
.app-header {
  position: relative;
  margin-bottom: 16px;
}

.app-header-brand {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hint);
  font-weight: 700;
  margin-bottom: 4px;
}

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

.app-header-name {
  font-size: 22px;
  font-weight: 900;
}

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

.menu-toggle-wrap {
  position: relative;
  flex-shrink: 0;
  z-index: 6;
}

.menu-toggle {
  width: 34px;
  height: 34px;
  border: 2px solid var(--text);
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 0;
}

.menu-toggle span {
  width: 15px;
  height: 2px;
  background: var(--text);
  display: block;
}

.menu-toggle-badge {
  position: absolute;
  top: -7px;
  right: -7px;
}

.dropdown {
  position: absolute;
  top: 52px;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 2.5px solid var(--text);
  box-shadow: 6px 6px 0 var(--accent);
  z-index: 5;
}

.dropdown-item {
  padding: 12px 14px;
  border-bottom: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

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

/* Тело главного экрана — контент о проекте */
.headline {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.12;
  text-transform: uppercase;
  margin: 18px 0 14px;
}

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

.quote {
  border-left: 4px solid var(--accent);
  padding-left: 12px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 14px;
}

.body-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--hint);
  margin-bottom: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  row-gap: 18px;
  margin-bottom: 22px;
}

.stats-grid > div {
  padding: 0 10px;
  border-left: 1px solid var(--border);
}

.stats-grid > div:nth-child(3n + 1) {
  padding-left: 0;
  border-left: none;
}

.stat-num {
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
}

.stat-label {
  font-size: 10px;
  color: var(--hint);
  margin-top: 4px;
  line-height: 1.25;
}

.microlabel {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hint);
  font-weight: 800;
  margin: 18px 0 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

.dir-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.dir-bar {
  width: 4px;
  background: var(--accent);
  flex-shrink: 0;
  align-self: stretch;
}

.dir-name {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.dir-desc {
  font-size: 12.5px;
  color: var(--hint);
}

.links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.links-row a {
  font-size: 12px;
  border: 2px solid var(--text);
  padding: 7px 11px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
}

.home-divider {
  border-top: 2px dashed var(--border);
  margin: 22px 0 16px;
}

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

.menu-btn {
  text-align: left;
  background: var(--card-bg);
  border: 2.5px solid var(--text);
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 800;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Календарь */
.calendar-group-title {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  background: var(--text);
  color: #fff;
  padding: 7px 10px;
  margin: 20px 0 12px;
}

.calendar-group-title.partner {
  background: var(--secondary-bg);
  color: var(--hint);
}

.calendar-entry {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.calendar-bar {
  width: 4px;
  flex-shrink: 0;
  align-self: stretch;
  background: var(--border);
}

.calendar-bar.own {
  background: var(--accent);
}

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

.calendar-entry-title {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.3;
  margin: 3px 0 3px;
}

.calendar-entry-meta {
  font-size: 12px;
  color: var(--hint);
}

.calendar-entry.partner .calendar-entry-title {
  font-size: 12.5px;
  font-weight: 700;
}

.calendar-entry.partner .calendar-entry-meta {
  font-size: 11px;
}

/* Тексты (регламент) */
.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;
}

.text-heading {
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
  margin: 22px 0 8px;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--accent);
}

.text-heading:first-child {
  margin-top: 0;
}

/* Мои баллы */
.score-big {
  font-size: 46px;
  font-weight: 900;
  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: 2px solid var(--border);
  padding: 12px 14px;
  margin-bottom: 8px;
}

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

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

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

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

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

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

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

/* ---------- Режимы приложения: общая шапка ---------- */
.mode-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  position: relative;
}
.mode-left { position: relative; min-width: 0; }
.mode-name {
  font-family: inherit;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.15;
  color: var(--text);
  background: none;
  border: none;
  padding: 0;
  text-align: left;
}
.mode-name.multi { cursor: pointer; border-bottom: 2.5px solid var(--accent); }
.mode-name:disabled { opacity: 1; color: var(--text); }
.mode-caret { display: inline-block; margin-left: 8px; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid var(--text); vertical-align: middle; }
.mode-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--card-bg);
  border: 2.5px solid var(--text);
  box-shadow: 6px 6px 0 var(--accent);
  z-index: 6;
}
.mode-option {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 12px 14px;
  background: none;
  border: none;
  border-bottom: 1.5px solid var(--border);
  color: var(--text);
  cursor: pointer;
}
.mode-option:last-child { border-bottom: none; }
.mode-option.current { background: var(--accent); }
.mode-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.mode-user { font-size: 13px; color: var(--hint); font-weight: 700; text-align: right; max-width: 120px; overflow-wrap: anywhere; }

.menu-btn.disabled { opacity: 0.55; cursor: default; }
.menu-btn .soon { font-size: 11px; font-weight: 700; color: var(--hint); text-transform: uppercase; }
a.menu-btn { text-decoration: none; }

.event-card { border: 2.5px solid var(--text); background: var(--card-bg); padding: 14px 16px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.event-title { font-size: 16px; font-weight: 900; }
.event-meta { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--hint); font-weight: 700; }
.waitlist { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.field { width: 100%; font-family: inherit; font-size: 15px; padding: 10px 12px; border: 2.5px solid var(--text); background: var(--card-bg); color: var(--text); }
.primary-btn, .danger-btn { font-family: inherit; font-size: 14px; font-weight: 800; padding: 12px 16px; border: 2.5px solid var(--text); background: var(--button-bg); color: var(--button-text); cursor: pointer; }
.primary-btn:disabled { opacity: 0.55; cursor: default; }
.danger-btn { background: var(--card-bg); color: var(--danger); border-color: var(--danger); }
.confirm-row { display: flex; gap: 10px; margin-top: 10px; }
.form-result { font-size: 14px; color: var(--hint); }
.profile-card { border: 2.5px solid var(--text); background: var(--card-bg); padding: 14px 16px; margin-bottom: 16px; }
.profile-name { font-size: 18px; font-weight: 900; }
.menu { display: flex; flex-direction: column; gap: 8px; }

.mode-nick { font-size: 12px; font-weight: 700; color: var(--hint); }
.menu-btn.soon-item { opacity: 0.8; }
.soon-tag { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; border: 2px solid var(--hint); color: var(--hint); padding: 2px 8px; margin-bottom: 12px; }
.eco-card { display: flex; flex-direction: column; gap: 4px; border: 2.5px solid var(--text); background: var(--card-bg); padding: 14px 16px; margin-bottom: 10px; text-decoration: none; color: var(--text); }
.eco-card.disabled { opacity: 0.65; }
.eco-name { font-size: 15px; font-weight: 900; }
.eco-desc { font-size: 13px; color: var(--hint); font-weight: 600; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--hint); letter-spacing: 0.04em; }
.form-static { font-size: 15px; font-weight: 800; }
.revoke-box { margin-top: 28px; }
