:root {
  --bg: #eef4e6;
  --surface: #fbfdf7;
  --surface-strong: #ffffff;
  --text: #182313;
  --muted: #68735d;
  --line: #d7e1cc;
  --leaf: #2f6d1f;
  --leaf-strong: #17480f;
  --sprout: #95c73d;
  --gold: #d99a18;
  --gold-soft: #f3d06c;
  --coin: #ffbf2e;
  --danger: #c95d2d;
  --shadow: 0 14px 36px rgba(35, 55, 24, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "SF Pro Text", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    linear-gradient(145deg, rgba(47, 109, 31, 0.18), rgba(255, 191, 46, 0.12) 38%, transparent 72%),
    var(--bg);
  color: var(--text);
}

body {
  padding: 0;
}

.screen {
  width: min(620px, 100%);
  margin: 0 auto;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.summary-panel,
.calendar-panel,
.day-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 253, 247, 0.94);
  box-shadow: var(--shadow);
}

.summary-panel {
  min-height: 116px;
  padding: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
  position: relative;
}

.summary-panel::before {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -42px;
  top: -54px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 191, 46, 0.54), rgba(149, 199, 61, 0.18) 58%, transparent 70%);
  pointer-events: none;
}

.kicker,
.section-label,
.status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.page-title {
  margin: 5px 0 0;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: 0;
}

.month-total {
  position: relative;
  display: grid;
  justify-items: end;
  gap: 5px;
  color: var(--leaf-strong);
}

.month-total-value-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  max-width: min(330px, calc(100vw - 36px));
  min-width: 0;
  flex-wrap: wrap;
}

.month-total-label {
  color: var(--muted);
  font-size: 12px;
}

.month-daily-typical {
  color: rgba(104, 115, 93, 0.92);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

.month-total strong {
  font-size: 21px;
  white-space: nowrap;
}

.calendar-panel,
.day-panel {
  padding: 14px;
}

.calendar-head,
.day-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.calendar-head > div {
  position: relative;
}

.section-title {
  margin: 3px 0 0;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: 0;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
}

.month-arrow,
.month-picker-button {
  border: 0;
  color: var(--leaf-strong);
  font: inherit;
  cursor: pointer;
}

.month-arrow {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(149, 199, 61, 0.2);
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: transform 140ms ease, background-color 140ms ease;
}

.month-arrow:hover {
  background: rgba(149, 199, 61, 0.34);
  transform: translateY(-1px);
}

.month-arrow:disabled {
  cursor: default;
  opacity: 0.38;
  transform: none;
}

.month-arrow:disabled:hover {
  background: rgba(149, 199, 61, 0.2);
}

.month-picker-button {
  min-height: 30px;
  border-radius: 8px;
  background: transparent;
  padding: 0 4px;
  text-align: left;
}

.month-picker-button:focus-visible,
.month-arrow:focus-visible {
  outline: 2px solid var(--leaf);
  outline-offset: 2px;
}

.month-menu {
  position: absolute;
  z-index: 10;
  top: 54px;
  left: 37px;
  width: min(250px, calc(100vw - 44px));
  max-height: 268px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 253, 247, 0.98);
  box-shadow: 0 18px 42px rgba(35, 55, 24, 0.2);
  padding: 6px;
}

.month-option {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  padding: 8px 10px;
}

.month-option:hover,
.month-option.is-active {
  background: rgba(149, 199, 61, 0.2);
}

.month-option.is-current::after {
  content: "сейчас";
  float: right;
  color: var(--muted);
  font-size: 11px;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row {
  gap: 6px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.calendar-grid {
  gap: 6px;
  margin-top: 7px;
}

.calendar-error {
  grid-column: 1 / -1;
  min-height: 120px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(201, 93, 45, 0.28);
  border-radius: 8px;
  background: rgba(255, 246, 229, 0.92);
  color: var(--danger);
}

.calendar-error strong {
  font-size: 18px;
}

.calendar-error span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.day-cell {
  min-width: 0;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #eef3e8;
  color: var(--text);
  font: inherit;
  padding: 5px;
  display: grid;
  align-content: space-between;
  justify-items: start;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.day-cell:hover {
  transform: translateY(-1px);
}

.day-cell:focus-visible {
  outline: 2px solid var(--leaf);
  outline-offset: 2px;
}

.day-cell.is-muted {
  opacity: 0.36;
  cursor: default;
}

.day-cell.is-future {
  opacity: 0.52;
}

.day-cell.is-today {
  border-color: var(--leaf-strong);
  box-shadow: inset 0 0 0 1px var(--leaf-strong), 0 0 0 3px rgba(255, 191, 46, 0.36);
}

.day-cell.is-selected {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold), 0 8px 18px rgba(118, 84, 18, 0.17);
}

.day-number {
  font-size: 12px;
  font-weight: 700;
}

.day-amount {
  width: 100%;
  overflow: hidden;
  color: rgba(24, 35, 19, 0.56);
  font-size: 10px;
  line-height: 1.1;
  font-weight: 650;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heat-0 {
  background: #eef3e8;
}

.heat-1 {
  background: #dcebbf;
}

.heat-2 {
  background: #bddf72;
}

.heat-3 {
  background: #86bd35;
}

.heat-4 {
  background: #3f8525;
  color: #ffffff;
}

.heat-4 .day-amount {
  color: rgba(255, 255, 255, 0.78);
}

.day-cell.is-selected .day-amount {
  color: rgba(24, 35, 19, 0.72);
}

.day-cell.is-selected.heat-4 .day-amount {
  color: rgba(255, 255, 255, 0.92);
}

.calendar-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.heat-scale {
  display: grid;
  grid-template-columns: repeat(5, 16px);
  gap: 4px;
}

.heat-scale i {
  display: block;
  height: 10px;
  border-radius: 3px;
}

.level-0 {
  background: #eef3e8;
}

.level-1 {
  background: #dcebbf;
}

.level-2 {
  background: #bddf72;
}

.level-3 {
  background: #86bd35;
}

.level-4 {
  background: #3f8525;
}

.day-detail-head strong {
  color: var(--leaf-strong);
  font-size: 18px;
  white-space: nowrap;
}

.expense-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.expense-item {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.expense-item.is-empty {
  border-style: dashed;
  background: rgba(251, 253, 247, 0.68);
}

.expense-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
}

.expense-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.expense-amount {
  color: var(--leaf-strong);
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

@media (max-width: 460px) {
  .screen {
    padding: 10px;
  }

  .summary-panel {
    align-items: flex-start;
    flex-direction: column;
    min-height: 132px;
    padding: 14px;
  }

  .month-total {
    justify-items: start;
  }

  .month-total-value-row {
    justify-content: flex-start;
    max-width: 100%;
  }

  .page-title {
    font-size: 28px;
  }

  .calendar-grid,
  .weekday-row {
    gap: 5px;
  }

  .day-cell {
    padding: 4px;
  }
}

@media (max-width: 360px) {
  .day-amount {
    display: none;
  }
}

.app-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid rgba(215, 225, 204, 0.9);
  border-radius: 10px;
  background: rgba(251, 253, 247, 0.72);
  box-shadow: 0 10px 28px rgba(35, 55, 24, 0.08);
}

.app-tab {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.app-tab.is-active {
  background: #6f805f;
  color: #fffdf4;
  box-shadow: 0 8px 20px rgba(57, 77, 48, 0.18);
}

.app-tab:focus-visible {
  outline: 2px solid var(--leaf);
  outline-offset: 2px;
}

.app-view {
  display: grid;
  gap: 12px;
}

.app-view[hidden] {
  display: none;
}

.progress-view {
  display: grid;
  gap: 12px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.progress-head > div {
  position: relative;
}

.progress-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 253, 247, 0.94);
  box-shadow: var(--shadow);
  padding: 14px;
}

.progress-section {
  display: grid;
  gap: 8px;
}

.progress-section-label {
  margin: 0;
  padding: 0 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.progress-small-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.progress-caption {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.progress-saving {
  display: grid;
  gap: 12px;
}

.progress-saving-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.progress-saving-value {
  margin-top: 2px;
  color: var(--leaf-strong);
  font-size: 31px;
  line-height: 1;
  font-weight: 750;
  letter-spacing: 0;
  white-space: nowrap;
}

.progress-switch {
  width: 164px;
  padding: 4px;
  border-radius: 10px;
  background: #edf3e8;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.progress-switch button {
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.progress-switch button.is-active {
  background: var(--surface-strong);
  color: var(--leaf-strong);
  box-shadow: 0 5px 12px rgba(35, 55, 24, 0.07);
}

.progress-saving-compare,
.progress-comparison {
  display: grid;
  gap: 10px;
}

.progress-saving-line {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 74px;
  gap: 8px;
  align-items: center;
}

.progress-saving-line span,
.progress-saving-line strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.progress-saving-line strong {
  text-align: right;
  white-space: nowrap;
}

.progress-track {
  display: block;
  height: 18px;
  border-radius: 6px;
  background: #edf2ec;
  overflow: hidden;
}

.progress-fill {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: var(--c);
}

.progress-months {
  position: relative;
  height: 150px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: end;
  gap: 8px;
  padding: 16px 3px 23px;
  border-bottom: 1px solid rgba(215, 225, 204, 0.78);
}

.progress-usual-line {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 82px;
  border-top: 1px dashed rgba(104, 115, 93, 0.54);
}

.progress-usual-line span {
  position: absolute;
  right: 0;
  top: -23px;
  padding: 4px 7px;
  border: 1px solid rgba(215, 225, 204, 0.95);
  border-radius: 999px;
  background: rgba(251, 253, 247, 0.96);
  color: var(--leaf-strong);
  font-size: 11px;
  font-weight: 750;
  box-shadow: 0 5px 14px rgba(35, 55, 24, 0.08);
}

.progress-month-col {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  justify-items: center;
  gap: 6px;
  cursor: pointer;
  font: inherit;
}

.progress-month-bar {
  width: 31px;
  height: var(--h);
  min-height: 18px;
  border-radius: 8px 8px 5px 5px;
  background: #dce6d5;
}

.progress-month-col.is-current .progress-month-bar {
  background: #7d9a72;
  box-shadow: 0 8px 17px rgba(117, 159, 120, 0.18);
}

.progress-month-col.is-preview .progress-month-bar {
  outline: 2px solid rgba(65, 107, 72, 0.34);
  outline-offset: 2px;
}

.progress-month-col span {
  color: inherit;
  font-size: 11px;
  font-weight: 650;
}

.progress-preview {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding-top: 2px;
}

.progress-preview-value {
  color: var(--leaf-strong);
  font-size: 15px;
  font-weight: 750;
  white-space: nowrap;
}

.progress-category-card {
  display: grid;
  gap: 12px;
}

.progress-category-layout {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 13px;
  align-items: center;
}

.progress-donut {
  width: 112px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: #edf2ec;
  display: grid;
  place-items: center;
  color: var(--leaf-strong);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.18;
  text-align: center;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(217, 227, 210, 0.92);
}

.progress-legend {
  display: grid;
  gap: 6px;
}

.progress-legend-item {
  width: 100%;
  border: 0;
  border-radius: 9px;
  padding: 6px 7px;
  background: transparent;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 7px;
  align-items: center;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.progress-legend-item.is-active,
.progress-legend-item:active {
  background: #f0f4ec;
}

.progress-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 4px;
  background: var(--c);
}

.progress-legend-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-legend-value {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.progress-drilldown {
  display: none;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(215, 225, 204, 0.78);
}

.progress-drilldown.is-open {
  display: grid;
}

.progress-drill-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--leaf-strong);
  font-size: 13px;
  font-weight: 750;
}

.progress-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar-name {
  width: 82px;
  flex-shrink: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-bar-track {
  flex: 1;
  height: 24px;
  border-radius: 7px;
  overflow: hidden;
  background: #edf2ec;
}

.progress-bar-fill {
  width: var(--w);
  min-width: 52px;
  max-width: 100%;
  height: 100%;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 7px;
  background: var(--c);
  color: #fffdf4;
  font-size: 11px;
  font-weight: 800;
  text-shadow: 0 1px 1px rgba(30, 39, 28, 0.18);
}

.progress-more-tags {
  padding-left: 90px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.progress-limits {
  display: grid;
  gap: 9px;
}

.progress-limit-head,
.progress-streak-top,
.progress-small-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.progress-limit-title {
  color: var(--leaf-strong);
  font-size: 14px;
  font-weight: 750;
}

.progress-limit-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
}

.progress-limit-right,
.progress-streak-count {
  color: #6f805f;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.progress-limit-track {
  height: 12px;
  margin-top: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8eee5;
}

.progress-limit-fill {
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: #7d9a72;
}

.progress-streak {
  display: grid;
  gap: 8px;
}

.progress-day-balls {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 4px;
}

.progress-day-ball {
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #edf1eb;
  border: 1px solid #dfe8d9;
  color: #a2ad9b;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
}

.progress-day-ball.ok {
  background: #aac99b;
  border-color: #aac99b;
  color: #fffdf4;
}

.progress-day-ball.over {
  background: #f4d9d3;
  border-color: #efb9af;
  color: #a94434;
}

.progress-empty-note {
  padding: 11px;
  border: 1px dashed #cad8c2;
  border-radius: 8px;
  background: #f5f8ef;
}

.progress-small-spends {
  display: grid;
  gap: 10px;
}

.progress-small-main {
  align-items: flex-end;
  padding: 11px;
  border: 1px solid rgba(215, 225, 204, 0.78);
  border-radius: 8px;
  background: #f5f8ef;
}

.progress-small-value {
  color: var(--leaf-strong);
  font-size: 24px;
  line-height: 1;
  font-weight: 750;
  white-space: nowrap;
}

.progress-stacked {
  height: 17px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  background: #e7eee3;
}

.progress-stacked i {
  width: var(--w);
  background: var(--c);
}

.progress-compare-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 48px;
  gap: 9px;
  align-items: center;
}

.progress-compare-name {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-compare-bars {
  display: grid;
  gap: 5px;
}

.progress-mini-line {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 43px;
  gap: 6px;
  align-items: center;
}

.progress-mini-label,
.progress-mini-value {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.progress-mini-value {
  text-align: right;
}

.progress-delta {
  font-size: 13px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.progress-delta.up {
  color: #bf7e68;
}

.progress-delta.down {
  color: #466f4a;
}

.tag-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 253, 247, 0.94);
  box-shadow: var(--shadow);
  padding: 14px;
}

.tag-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.tag-head > div {
  position: relative;
}

.tag-stage {
  position: relative;
  min-height: 370px;
  margin-top: 14px;
  border: 1px solid rgba(215, 225, 204, 0.92);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(238, 244, 230, 0.56));
  overflow: hidden;
}

.tag-glass-canvas {
  display: block;
  width: 100%;
  height: 370px;
}

.stage-info {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  z-index: 3;
  min-height: 48px;
  border: 1px solid rgba(215, 225, 204, 0.92);
  border-radius: 10px;
  background: rgba(251, 253, 247, 0.86);
  backdrop-filter: blur(8px);
  padding: 8px 10px;
  display: grid;
  gap: 2px;
  pointer-events: none;
  box-shadow: 0 10px 24px rgba(35, 55, 24, 0.08);
}

.stage-info[hidden] {
  display: none;
}

.stage-info strong {
  color: var(--leaf-strong);
  font-size: 14px;
  line-height: 1.08;
}

.stage-info span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.stage-info b {
  color: var(--text);
  font-weight: 750;
}

.glass-empty {
  position: absolute;
  inset: 54px 24px auto;
  display: grid;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  pointer-events: none;
  z-index: 2;
}

.glass-empty strong {
  color: var(--leaf-strong);
  font-size: 18px;
}

.glass-empty span {
  font-size: 13px;
  line-height: 1.35;
}

.tag-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 112px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 4px 2px 1px;
  scrollbar-width: thin;
  scrollbar-color: rgba(104, 115, 93, 0.28) transparent;
}

.tag-legend::-webkit-scrollbar {
  width: 4px;
}

.tag-legend::-webkit-scrollbar-thumb {
  background: rgba(104, 115, 93, 0.24);
  border-radius: 999px;
}

.tag-chip {
  --tag-color: #b7dfc8;
  min-width: 0;
  min-height: 46px;
  border: 1px solid rgba(215, 225, 204, 0.96);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  text-align: left;
  font: inherit;
  transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.tag-chip:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--tag-color) 54%, var(--line));
}

.tag-chip.is-active {
  border-color: var(--tag-color);
  background: color-mix(in srgb, var(--tag-color) 13%, #ffffff);
  box-shadow: 0 10px 22px rgba(35, 55, 24, 0.1);
  transform: translateY(-1px);
}

.tag-chip:focus-visible {
  outline: 2px solid var(--leaf);
  outline-offset: 2px;
}

.tag-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tag-color);
  box-shadow: inset 0 0 0 1px rgba(24, 35, 19, 0.1), 0 0 0 4px color-mix(in srgb, var(--tag-color) 18%, transparent);
}

.tag-chip-main {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.tag-chip-main strong,
.tag-chip-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-chip-main strong {
  font-size: 13px;
  line-height: 1;
}

.tag-chip-main small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.tag-chip.is-muted-tag {
  color: color-mix(in srgb, var(--text) 82%, #ffffff);
}

.tag-chip.is-muted-tag .tag-dot {
  box-shadow: inset 0 0 0 1px rgba(24, 35, 19, 0.08), 0 0 0 4px rgba(104, 115, 93, 0.08);
}

.tag-empty-copy {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 460px) {
  .app-tab {
    min-height: 38px;
  }

  .progress-card {
    padding: 12px;
  }

  .progress-saving-top {
    display: grid;
  }

  .progress-switch {
    width: 100%;
  }

  .progress-category-layout {
    grid-template-columns: 104px 1fr;
    gap: 10px;
  }

  .progress-donut {
    width: 100px;
  }

  .progress-bar-name,
  .progress-compare-name {
    width: 72px;
    font-size: 11px;
  }

  .progress-compare-row {
    grid-template-columns: 72px 1fr 39px;
  }

  .progress-more-tags {
    padding-left: 80px;
  }

  .tag-panel {
    padding: 12px;
  }

  .tag-stage {
    min-height: 360px;
  }

  .tag-glass-canvas {
    height: 360px;
  }
}

@supports not (color: color-mix(in srgb, white, black)) {
  .tag-chip:hover,
  .tag-chip.is-active {
    border-color: var(--tag-color);
  }

  .tag-chip.is-active {
    background: rgba(238, 243, 232, 0.92);
  }
}
