/* Mobile UX polish v74 */

.overview-inline-motivation {
  min-height: 34px;
  margin-top: var(--tt-space-2);
  padding: 5px var(--tt-space-2);
  border-left-width: 2px;
  background: color-mix(in srgb, var(--tt-action-soft) 78%, transparent);
}

.overview-inline-motivation .ui-icon {
  width: 16px;
  height: 16px;
}

.overview-inline-motivation strong {
  font-size: var(--tt-type-micro);
  line-height: 1.3;
}

.overview-turnus-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: visible;
  border: 0;
  border-top: var(--tt-border-width) solid var(--tt-border-strong);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.overview-turnus-details .overview-card-head {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 2px 6px;
  border: 0;
}

.overview-detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  align-content: start;
  padding: var(--tt-space-2) var(--tt-space-3) var(--tt-space-2) 2px;
  border: 0;
}

.overview-detail-row + .overview-detail-row {
  padding-right: 2px;
  padding-left: var(--tt-space-3);
  border-left: var(--tt-border-width) solid var(--tt-border-soft);
}

.overview-detail-row > strong {
  grid-row: auto;
  font-size: 1.08rem;
}

.overview-detail-row > small {
  line-height: 1.3;
}

.calendar-sticky-nav {
  position: sticky;
  z-index: 24;
  top: 0;
  display: grid;
  max-height: 0;
  min-height: 0;
  margin: 0 calc(var(--tt-space-3) * -1);
  padding: 0 var(--tt-space-3);
  border-bottom: var(--tt-border-width) solid transparent;
  overflow: hidden;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  background: color-mix(in srgb, var(--tt-bg) 96%, transparent);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition:
    max-height var(--tt-duration-fast) var(--tt-ease-standard),
    min-height var(--tt-duration-fast) var(--tt-ease-standard),
    margin var(--tt-duration-fast) var(--tt-ease-standard),
    opacity var(--tt-duration-fast) var(--tt-ease-standard),
    transform var(--tt-duration-fast) var(--tt-ease-standard);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.calendar-sticky-nav.is-visible {
  max-height: 46px;
  min-height: 46px;
  margin-bottom: var(--tt-space-2);
  border-bottom-color: var(--tt-border);
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.calendar-sticky-nav strong {
  overflow: hidden;
  font-size: var(--tt-type-caption);
  font-weight: 820;
  letter-spacing: var(--tt-tracking-label);
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.calendar-sticky-nav button {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--tt-radius-sm);
  place-items: center;
  background: transparent;
  color: var(--tt-text-primary);
  cursor: pointer;
}

.calendar-sticky-nav button:active {
  background: var(--tt-surface-sunken);
  transform: scale(0.98);
}

.calendar-sticky-nav.year-mode strong {
  font-size: var(--tt-type-body);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.toolbar-wrap {
  position: static;
  z-index: auto;
  top: auto;
  margin: 0 0 var(--tt-space-3);
  padding: 0;
  border: 0;
  overflow: visible;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.toolbar {
  gap: 6px;
}

.tool {
  min-height: 58px;
  border-color: var(--tt-border);
  background: var(--tt-surface-elevated);
  box-shadow: inset 0 3px 0 color-mix(in srgb, var(--tool-color) 78%, transparent);
}

.tool[data-tool="roadOut"],
.tool[data-tool="roadBack"] {
  background: color-mix(in srgb, var(--tt-state-road) 6%, var(--tt-surface-elevated));
}

.tool.active {
  box-shadow: none;
}

.toolbar-utility {
  min-height: 36px;
  justify-content: space-between;
}

.tool.tool-utility[data-tool="delete"] {
  padding-right: var(--tt-space-2);
  padding-left: var(--tt-space-1);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--tt-error);
}

.tool.tool-utility[data-tool="delete"].active {
  background: var(--tt-error-soft);
  color: var(--tt-error);
}

.calendar-card {
  border-color: var(--tt-border-soft);
  box-shadow: none;
}

.turnus-card {
  border-color: var(--tt-border-soft);
  box-shadow: none;
}

.turnus-card.active-card {
  border-color: transparent;
}

.turnus-card.planned-card {
  border-color: var(--tt-border-strong);
}

.card-metrics {
  margin-top: var(--tt-space-3);
  border: 0;
  border-top: var(--tt-border-width) solid var(--tt-border);
  border-radius: 0;
  background: transparent;
}

.metric-mini {
  padding-top: var(--tt-space-2);
  padding-bottom: 2px;
}

.turnus-detail-overview .turnus-mini-calendar {
  margin: var(--tt-space-3) 0;
  padding: var(--tt-space-3) 0 var(--tt-space-2);
  border: 0;
  border-top: var(--tt-border-width) solid var(--tt-border-strong);
  border-bottom: var(--tt-border-width) solid var(--tt-border-soft);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.turnus-detail-overview .turnus-mini-calendar h3 {
  margin-bottom: var(--tt-space-2);
  padding-bottom: var(--tt-space-2);
  border-bottom-color: var(--tt-border-soft);
}

.turnus-detail-overview .turnus-month-block + .turnus-month-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top-color: var(--tt-border-soft);
}

.turnus-detail-overview .turnus-day-chip,
.turnus-detail-overview .turnus-day-spacer {
  min-height: 39px;
}

.turnus-detail-overview .turnus-day-chip {
  border-color: var(--tt-border-soft);
  border-radius: var(--tt-radius-xs);
  box-shadow: none;
}

.stats-grid {
  gap: 0;
  overflow: hidden;
  border: var(--tt-border-width) solid var(--tt-border);
  border-radius: var(--tt-radius-lg);
  background: var(--tt-surface-elevated);
}

.stat-card,
.stat-card:nth-child(2n),
.stat-card:last-child,
.stat-card:nth-last-child(2):nth-child(odd),
.stat-card:last-child:nth-child(odd) {
  min-height: 80px;
  padding: var(--tt-space-3);
  border: 0;
  border-right: var(--tt-border-width) solid var(--tt-border-soft);
  border-bottom: var(--tt-border-width) solid var(--tt-border-soft);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.stat-card:nth-child(2n) {
  border-right: 0;
}

.stat-card:last-child,
.stat-card:nth-last-child(2):nth-child(odd) {
  border-bottom: 0;
}

.stat-card:last-child:nth-child(odd) {
  border-right: 0;
  grid-column: 1 / -1;
}

.stats-chart {
  padding: var(--tt-space-4) 0 0;
  border: 0;
  border-top: var(--tt-border-width) solid var(--tt-border-strong);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.stats-chart h3 {
  margin-bottom: var(--tt-space-3);
  padding: 0 2px var(--tt-space-2);
  border-bottom-color: var(--tt-border-soft);
}

.stats-chart-heading {
  display: flex;
  min-height: 38px;
  margin-bottom: var(--tt-space-3);
  padding: 0 2px var(--tt-space-2);
  border-bottom: var(--tt-border-width) solid var(--tt-border-soft);
  align-items: center;
  justify-content: space-between;
  gap: var(--tt-space-2);
}

.stats-chart .stats-chart-heading h3 {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  line-height: 1.25;
}

.stats-chart .stats-chart-heading h3::after {
  display: none;
}

.chart-selection {
  display: grid;
  flex: 0 0 auto;
  min-width: 78px;
  padding: 4px 7px;
  border-left: 2px solid var(--tt-action);
  border-radius: var(--tt-radius-xs);
  justify-items: end;
  background: var(--tt-action-soft);
  line-height: 1.15;
}

.chart-selection span {
  color: var(--tt-text-secondary);
  font-size: 0.56rem;
  font-weight: 760;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.chart-selection strong {
  color: var(--tt-text-primary);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.stats-chart-body {
  display: grid;
  height: 154px;
  padding: 0 2px;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 7px;
}

.chart-y-axis {
  position: relative;
  height: 132px;
  color: var(--tt-text-muted);
  font-size: 0.55rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
}

.chart-unit-label {
  flex: 0 0 auto;
  color: var(--tt-text-muted);
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.chart-y-tick {
  position: absolute;
  right: 0;
  bottom: var(--tick-position);
  transform: translateY(50%);
  white-space: nowrap;
}

.chart-plot {
  position: relative;
  min-width: 0;
  height: 154px;
}

.chart-grid-lines {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  bottom: 22px;
  left: 0;
  pointer-events: none;
}

.chart-grid-lines span {
  position: absolute;
  right: 0;
  bottom: var(--tick-position);
  left: 0;
  border-top: var(--tt-border-width) solid color-mix(in srgb, var(--tt-border) 72%, transparent);
}

.stats-chart .bar-chart {
  position: relative;
  z-index: 1;
  height: 154px;
  gap: 3px;
  align-items: stretch;
  background: none;
}

.stats-chart .bar-item {
  display: grid;
  min-width: 0;
  height: 154px;
  grid-template-rows: minmax(0, 1fr) 22px;
  align-items: stretch;
  border-radius: 2px;
}

.bar-track {
  position: relative;
  display: flex;
  min-height: 0;
  align-items: flex-end;
}

.stats-chart .bar {
  width: 100%;
  min-height: 0;
  border-radius: 3px 3px 1px 1px;
  background: color-mix(in srgb, var(--tt-action) 78%, var(--tt-surface-inverse));
  transition:
    height var(--tt-duration-normal) var(--tt-ease-standard),
    background-color var(--tt-duration-fast) var(--tt-ease-standard),
    filter var(--tt-duration-fast) var(--tt-ease-standard);
}

.bar-item:not(.has-value) .bar {
  height: 0 !important;
  min-height: 0;
}

.stats-chart .bar-item small {
  overflow: hidden;
  margin: 0;
  align-self: center;
  color: var(--tt-text-muted);
  font-size: 0.53rem;
  font-weight: 780;
  line-height: 1;
  text-align: center;
  text-overflow: clip;
  text-transform: uppercase;
  transform: none;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}

.stats-chart .bar-item.is-current-month:not(.is-selected) .bar {
  background: color-mix(in srgb, var(--tt-action) 90%, var(--tt-surface-inverse));
}

.stats-chart .bar-item.is-current-month:not(.is-selected) small {
  color: var(--tt-text-primary);
}

.stats-chart .bar-item.is-selected {
  background: color-mix(in srgb, var(--tt-action) 8%, transparent);
}

.stats-chart .bar-item.is-selected .bar {
  background: var(--tt-action);
  filter: none;
}

.stats-chart .bar-item.is-selected small {
  color: var(--tt-action);
  font-weight: 850;
}

.stats-chart .bar-item:focus-visible {
  outline: 2px solid var(--tt-action);
  outline-offset: 1px;
}

.quarter-card {
  border: 0;
  border-left: 3px solid var(--tt-border-strong);
  border-radius: var(--tt-radius-sm);
  background: color-mix(in srgb, var(--tt-surface-elevated) 80%, transparent);
  box-shadow: none;
}

.quarter-card::before {
  display: none;
}

.quarter-card.active {
  border-left-color: var(--tt-action);
}

.settings-hub-page .settings-section-label {
  margin-top: 10px;
  margin-bottom: 4px;
}

.settings-hub-group {
  border-color: var(--tt-border-soft);
  border-radius: var(--tt-radius-sm);
  box-shadow: none;
}

.settings-hub-row {
  min-height: 46px;
  padding-top: var(--tt-space-2);
  padding-bottom: var(--tt-space-2);
}

@media (max-width: 390px) {
  .calendar-sticky-nav {
    margin-right: -10px;
    margin-left: -10px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .toolbar-wrap {
    margin-right: 0;
    margin-left: 0;
    padding-right: 0;
    padding-left: 0;
  }

  .tool {
    min-height: 56px;
  }

  .overview-turnus-details {
    padding: 0;
  }

  .stats-chart-body {
    grid-template-columns: 31px minmax(0, 1fr);
    gap: 5px;
  }

  .stats-chart .bar-chart {
    gap: 2px;
  }

  .stats-chart .bar-item small {
    font-size: 0.49rem;
  }

  .chart-selection {
    min-width: 72px;
    padding-right: 5px;
    padding-left: 5px;
  }
}

@media (min-width: 600px) {
  .calendar-sticky-nav {
    margin-right: calc(var(--tt-space-5) * -1);
    margin-left: calc(var(--tt-space-5) * -1);
    padding-right: var(--tt-space-5);
    padding-left: var(--tt-space-5);
  }

  .toolbar-wrap {
    margin-right: 0;
    margin-left: 0;
    padding-right: 0;
    padding-left: 0;
  }

  .tool {
    min-height: 62px;
  }
}
