:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8f9fb;
  --text: #16202a;
  --muted: #75808b;
  --line: #e5e9ee;
  --blue: #1769e0;
  --blue-soft: #e9f2ff;
  --green: #31a965;
  --orange: #ef941f;
  --purple: #8058c7;
  --yellow: #eabf36;
  --sk-blue: #2c84d8;
  --red: #de4d58;
  --shadow: 0 12px 32px rgba(23, 34, 45, 0.08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top)) 18px 14px;
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 25px;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.avatar-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: var(--text);
  color: white;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.page {
  padding: 0 14px 22px;
}

.section-title {
  margin: 22px 4px 11px;
  font-size: 18px;
  letter-spacing: -0.025em;
}

.card {
  border: 1px solid rgba(222, 227, 233, 0.9);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.calendar-header {
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  align-items: center;
  margin-bottom: 10px;
}

.month-title {
  text-align: center;
}

.month-title h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.month-title button {
  margin-top: 3px;
  padding: 3px 8px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.view-switch {
  display: flex;
  width: fit-content;
  margin: 0 auto 12px;
  padding: 3px;
  border-radius: 12px;
  background: #e8ebef;
}

.view-switch button {
  min-height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.view-switch button.active {
  background: white;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(30, 41, 53, 0.1);
}

.toolbar-wrap {
  position: sticky;
  z-index: 8;
  top: 0;
  margin: 0 -14px 12px;
  padding: 8px 14px 10px;
  overflow: hidden;
  background: rgba(244, 246, 248, 0.96);
  backdrop-filter: blur(14px);
}

.toolbar {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 1px;
  scrollbar-width: none;
}

.toolbar::-webkit-scrollbar {
  display: none;
}

.tool {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.015em;
  cursor: pointer;
}

.tool.active {
  border-color: transparent;
  color: white;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--tool-color) 32%, transparent);
  background: var(--tool-color);
}

.tool.done {
  border-color: var(--text);
  background: var(--text);
  color: white;
}

.banner-carousel {
  margin-bottom: 12px;
  touch-action: pan-y;
  user-select: none;
}

.turnus-banner {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 15px;
  border: 0;
  color: white;
  text-align: left;
  background: linear-gradient(135deg, #202c38, #35475a);
  cursor: grab;
}

.turnus-banner:active {
  cursor: grabbing;
}

.turnus-banner.banner-active {
  background: linear-gradient(135deg, #176d48, #258f61);
}

.turnus-banner.banner-planned {
  background: linear-gradient(135deg, #315c9b, #4d79bd);
}

.turnus-banner.banner-empty {
  min-height: 102px;
  grid-template-columns: 1fr;
  background: linear-gradient(135deg, #4a5662, #697581);
}

.turnus-banner .status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: #b9d0e5;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #55d98d;
}

.turnus-banner h3 {
  margin: 0 0 5px;
  font-size: 18px;
}

.turnus-banner p {
  margin: 0;
  color: #cbd7e2;
  font-size: 12px;
}

.banner-money {
  align-self: center;
  text-align: right;
}

.banner-money strong {
  display: block;
  font-size: 20px;
}

.banner-money span {
  color: #cbd7e2;
  font-size: 10px;
}

.banner-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding-top: 7px;
}

.banner-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #c5ccd3;
  cursor: pointer;
}

.banner-dot.active {
  width: 18px;
  border-radius: 99px;
  background: var(--blue);
}

.calendar-swipe-stage {
  position: relative;
  overflow: hidden;
  margin-top: 0;
  touch-action: pan-y;
  --calendar-drag-x: 0px;
}

.calendar-swipe-track {
  display: flex;
  width: 300%;
  transform: translateX(calc(-33.333333% + var(--calendar-drag-x)));
  transition: transform 0.24s ease;
  will-change: transform;
}

.calendar-swipe-stage.dragging .calendar-swipe-track {
  transition: none;
}

.calendar-swipe-panel {
  flex: 0 0 33.333333%;
  padding: 0 1px;
}

.calendar-swipe-arrows {
  position: absolute;
  z-index: 3;
  top: 13px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.calendar-swipe-arrows span {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  background: rgba(23, 105, 224, 0.08);
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  box-shadow: none;
  opacity: 0.75;
}

.calendar-card {
  padding: 7px 6px;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}

.calendar-card.paint-mode {
  touch-action: none;
}

.calendar-card-title {
  padding: 2px 0 1px;
  color: #6f7a85;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.weekday {
  padding: 5px 0 7px;
  color: #8b949d;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.day-cell {
  position: relative;
  min-width: 0;
  min-height: 66px;
  padding: 4px 2px;
  border: 0;
  border-top: 1px solid #eef1f4;
  border-left: 1px solid #eef1f4;
  background: white;
  cursor: pointer;
}

.day-cell:nth-child(7n + 1) {
  border-left: 0;
}

.day-cell.overflow {
  opacity: 0.18;
}

.day-cell.future .segments {
  opacity: 0.58;
}

.day-number {
  position: relative;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 23px;
  height: 23px;
  margin-bottom: 2px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.day-cell.today .day-number {
  outline: 2px solid var(--blue);
  outline-offset: -1px;
  color: var(--blue);
  background: white;
}

.calendar-card.turnus-highlight-mode .day-cell.dimmed-by-turnus {
  opacity: 0.22;
}

.calendar-card.turnus-highlight-mode .day-cell.highlighted-turnus-day {
  z-index: 1;
  background: #f3fbf7;
  box-shadow: inset 0 0 0 2px rgba(49, 169, 101, 0.38);
}

.calendar-card.turnus-highlight-mode .day-cell.highlighted-turnus-day .day-number {
  color: white;
  background: var(--green);
}

.segments {
  display: flex;
  width: 100%;
  min-height: 31px;
  overflow: hidden;
  border-radius: 6px;
}

.segment {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px 0;
  color: white;
  font-size: 7px;
  font-weight: 850;
  line-height: 1.15;
}

.segment small {
  display: block;
  max-width: 100%;
  margin-top: 2px;
  overflow: hidden;
  font-size: 7px;
  font-weight: 700;
  text-overflow: clip;
  white-space: nowrap;
}

.type-roadOut,
.type-roadBack {
  background: var(--purple);
}

.type-workDE {
  background: var(--green);
}

.type-sun {
  background: var(--orange);
}

.type-home {
  color: #3d3515;
  background: var(--yellow);
}

.type-workSK {
  background: var(--sk-blue);
}

.type-holiday {
  background: var(--red);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 13px;
  padding: 13px 8px 2px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.legend i {
  width: 8px;
  height: 8px;
  border-radius: 3px;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  touch-action: pan-y;
  user-select: none;
}

.mini-month {
  min-width: 0;
  padding: 7px 4px 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.mini-month:active {
  transform: scale(0.98);
}

.mini-month:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.mini-month h3 {
  margin: 0 0 5px;
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
}

.mini-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px 0;
}

.mini-day {
  display: grid;
  place-items: center;
  width: min(100%, 15px);
  height: 15px;
  min-width: 0;
  margin: 0 auto;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 5.5px;
  line-height: 1;
}

.mini-day.has-data {
  color: white;
  background: var(--mini-color);
}

.mini-day.future {
  opacity: 0.55;
}

.mini-day.overflow {
  opacity: 0;
  pointer-events: none;
}

.mini-day.today {
  outline: 1.5px solid var(--blue);
  outline-offset: 1px;
}

.list-stack {
  display: grid;
  gap: 11px;
}

.turnus-card {
  width: 100%;
  padding: 17px;
  border: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
}

.turnus-card.active-card {
  border-color: #9eddbb;
  background: linear-gradient(135deg, #f5fff9, white);
}

.turnus-card.planned-card {
  border-color: #c8d8ff;
  background: linear-gradient(135deg, #f5f8ff, white);
}

.turnus-card.planned-card .pill {
  background: #e9efff;
  color: #4f68a8;
}

.card-topline,
.card-metrics,
.setting-row,
.detail-row,
.sheet-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.turnus-card h3 {
  margin: 5px 0 4px;
  font-size: 18px;
}

.turnus-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.turnus-card .turnus-rate-summary {
  margin-top: 5px;
  color: var(--text);
  font-size: 11px;
  font-weight: 750;
}

.turnus-hero {
  padding: 18px;
  border-radius: 24px;
  color: white;
  background: linear-gradient(135deg, #1f3144, #132232);
}

.turnus-hero .card-topline {
  color: #bfd0df;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.turnus-hero .pill {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.turnus-hero > strong {
  display: block;
  margin-top: 14px;
  font-size: clamp(34px, 10vw, 48px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.turnus-hero p {
  margin: 8px 0 0;
  color: #c8d5df;
  font-size: 13px;
}

.turnus-hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.turnus-hero-grid.completed,
.turnus-hero-grid.status-active,
.turnus-hero-grid.status-completed,
.turnus-hero-grid.status-planned {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.turnus-hero-grid div {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
}

.turnus-hero-grid span {
  display: block;
  color: #b8c7d4;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.turnus-hero-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.turnus-hero-grid small {
  display: block;
  margin-top: 5px;
  color: #d9e4ec;
  font-size: 11px;
  font-weight: 850;
}

.turnus-countdown {
  font-weight: 800;
}

.turnus-mini-calendar {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #cfeedd;
  border-radius: 24px;
  background: linear-gradient(180deg, #f2fff7, #ffffff);
}

.turnus-mini-calendar h3 {
  margin: 0 0 9px;
  font-size: 14px;
}

.turnus-month-block + .turnus-month-block {
  margin-top: 16px;
}

.turnus-month-title {
  margin-bottom: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.turnus-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 5px;
  color: #7c8a95;
  font-size: 8px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.turnus-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.turnus-day-spacer {
  min-height: 42px;
}

.turnus-day-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 45px;
  padding: 4px 2px;
  border: 1px solid #d8e7df;
  border-radius: 12px;
  background: white;
  color: var(--text);
  box-shadow: 0 4px 10px rgba(18, 34, 50, 0.05);
}

.turnus-day-number,
.turnus-day-type {
  display: block;
  color: inherit;
  line-height: 1.05;
  text-align: center;
}

.turnus-day-number {
  font-size: 16px;
  font-weight: 950;
  color: var(--text);
}

.turnus-day-type {
  margin-top: 3px;
  color: #6f7c87;
  font-size: 8px;
  font-weight: 900;
}

.turnus-day-chip[class*="turnus-type-"] {
  color: white;
  border-color: transparent;
}

.turnus-day-chip[class*="turnus-type-"] .turnus-day-number {
  color: white;
}

.turnus-day-chip[class*="turnus-type-"] .turnus-day-type {
  color: rgba(255, 255, 255, 0.82);
}

.turnus-day-chip.turnus-type-roadOut,
.turnus-day-chip.turnus-type-roadBack {
  background: var(--purple);
}

.turnus-day-chip.turnus-type-workDE {
  background: var(--green);
}

.turnus-day-chip.turnus-type-sun {
  background: var(--orange);
}

.turnus-day-chip.turnus-type-home {
  background: var(--yellow);
}

.turnus-day-chip.turnus-type-workSK {
  background: var(--sk-blue);
}

.turnus-day-chip.turnus-type-holiday {
  background: var(--red);
}

.turnus-day-chip.turnus-type-home,
.turnus-day-chip.turnus-type-home .turnus-day-number,
.turnus-day-chip.turnus-type-home .turnus-day-type {
  color: #3d3515;
}

.turnus-day-chip.today {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.highlight-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-color: #cfeedd;
  background: #f2fff7;
}

.highlight-notice span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.highlight-notice strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
}

.highlight-notice button {
  width: auto;
  min-width: 76px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf1f5;
  color: #66727d;
  font-size: 10px;
  font-weight: 800;
}

.pill.active {
  background: #dff7e9;
  color: #18824b;
}

.money {
  color: #15804a;
  font-size: 19px;
  font-weight: 850;
}

.card-metrics {
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid #edf0f3;
}

.metric-mini {
  flex: 1;
}

.metric-mini strong {
  display: block;
  font-size: 14px;
}

.metric-mini span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.overview-page {
  display: grid;
  gap: 12px;
}

.overview-page .section-title {
  margin-bottom: 0;
}

.overview-hero {
  padding: 20px;
  color: white;
  background: linear-gradient(135deg, #1769e0, #2f91ee);
}

.overview-hero > span,
.overview-card-head span,
.motivation-card span {
  color: inherit;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.overview-hero p {
  margin: 16px 0 3px;
  color: #dbeaff;
  font-size: 13px;
}

.overview-hero strong {
  display: block;
  font-size: clamp(42px, 13vw, 58px);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.overview-hero-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin-top: 15px;
  color: #e5f0ff;
  font-size: 12px;
  font-weight: 750;
}

.overview-card,
.motivation-card {
  padding: 16px;
}

.overview-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #70808f;
}

.overview-card h3 {
  margin: 0 0 4px;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.overview-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.mini-link {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 10px;
  font-weight: 850;
  cursor: pointer;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.progress-head strong {
  color: var(--text);
}

.progress-bar {
  height: 9px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: #e8edf2;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #31a965, #73d39a);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.overview-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.overview-metric {
  padding: 12px;
  border-radius: 16px;
  box-shadow: none;
}

.overview-metric span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.overview-metric strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
  letter-spacing: -0.04em;
}

.overview-metric small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.overview-note {
  margin-top: 12px !important;
  font-weight: 850;
}

.record-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.record-row strong {
  color: var(--text);
  text-align: right;
}

.motivation-card {
  border-color: #cfeedd;
  background: linear-gradient(135deg, #f1fff6, #ffffff);
}

.motivation-card span {
  color: var(--green);
}

.motivation-card strong {
  display: block;
  margin-top: 8px;
  font-size: 17px;
  letter-spacing: -0.03em;
}

.period-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 1px 12px;
  scrollbar-width: none;
}

.period-tabs button {
  flex: 0 0 auto;
  min-height: 39px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.period-tabs button.active {
  border-color: var(--text);
  background: var(--text);
  color: white;
}

.stats-controls {
  display: grid;
  gap: 10px;
  margin-bottom: 11px;
  padding: 14px;
}

.stats-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.stats-controls select {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.quarter-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.quarter-picker button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--muted);
  font-weight: 900;
}

.quarter-picker button.active {
  border-color: var(--blue);
  background: #edf4ff;
  color: var(--blue);
}

.stats-hero {
  padding: 20px;
  color: white;
  background: linear-gradient(135deg, #1769e0, #318ee9);
}

.stats-hero p {
  margin: 0;
  color: #d9eaff;
  font-size: 12px;
}

.stats-hero strong {
  display: block;
  margin: 5px 0 12px;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.stats-hero .earnings-split {
  display: flex;
  gap: 20px;
  font-size: 11px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 11px;
}

.stat-card {
  padding: 16px;
}

.stat-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

.stats-chart {
  margin-top: 11px;
  padding: 16px;
}

.stats-chart h3 {
  margin: 0 0 12px;
  font-size: 14px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: end;
  height: 150px;
  gap: 5px;
}

.bar-item {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  cursor: pointer;
}

.bar {
  display: block;
  width: 100%;
  min-height: 6px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #36aa6b, #1769e0);
}

.bar-item small {
  margin-top: 5px;
  font-size: 7px;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.quarter-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 11px;
}

.quarter-card {
  padding: 14px;
  border: 1px solid var(--line);
  text-align: left;
}

.quarter-card.active {
  border-color: var(--blue);
  background: #f3f8ff;
}

.quarter-card span,
.quarter-card small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.quarter-card strong {
  display: block;
  margin: 5px 0;
  font-size: 18px;
}

.settings-group {
  margin-bottom: 14px;
  overflow: hidden;
}

.setting-row {
  min-height: 61px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
  border-bottom: 0;
}

.account-row {
  align-items: flex-start;
  padding-top: 14px;
  padding-bottom: 14px;
}

.account-main strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.account-actions {
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.account-actions .pill {
  margin: 0;
}

.account-actions .cloud-syncing {
  color: #1967d2;
  background: #e8f1ff;
}

.account-actions .cloud-offline {
  color: #87620a;
  background: #fff2c7;
}

.account-actions .cloud-error {
  color: #b4232d;
  background: #ffe7e9;
}

.account-actions .secondary-button,
.account-actions .primary-button {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 12px;
  font-size: 12px;
}

.setting-row label,
.setting-row .label {
  font-size: 13px;
  font-weight: 750;
}

.setting-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.setting-row input,
.setting-row select {
  width: 98px;
  min-height: 40px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  text-align: right;
}

.label-custom-head,
.label-custom-row {
  display: grid;
  grid-template-columns: 1fr 84px 64px;
  gap: 8px;
  align-items: center;
  padding: 8px 16px;
}

.label-custom-head {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.label-custom-row {
  border-top: 1px solid var(--line);
}

.label-custom-row strong {
  display: block;
  font-size: 12px;
}

.label-custom-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.label-custom-row input {
  width: 100%;
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  text-align: center;
  font-weight: 800;
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  border: 0;
  border-radius: 99px;
  background: #cbd2d9;
  cursor: pointer;
}

.toggle::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  content: "";
  transition: transform 0.18s;
}

.toggle.on {
  background: var(--green);
}

.toggle.on::after {
  transform: translateX(20px);
}

.danger-button,
.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 13px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  border: 0;
  background: var(--blue);
  color: white;
}

.secondary-button {
  border: 1px solid var(--line);
  background: white;
}

.danger-button {
  width: 100%;
  border: 1px solid #f1bdc1;
  background: #fff5f5;
  color: #c83742;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, 760px);
  min-height: calc(70px + env(safe-area-inset-bottom));
  margin: auto;
  padding: 7px 8px env(safe-area-inset-bottom);
  border-top: 1px solid rgba(218, 224, 230, 0.9);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: flex;
  min-height: 55px;
  border: 0;
  background: transparent;
  color: #8b949d;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 8.5px;
  font-weight: 750;
  cursor: pointer;
}

.nav-item.active {
  color: var(--blue);
}

.nav-icon {
  position: relative;
  display: block;
  width: 20px;
  height: 20px;
}

.calendar-icon {
  border: 2px solid currentColor;
  border-radius: 5px;
}

.calendar-icon::before {
  position: absolute;
  top: 4px;
  right: 2px;
  left: 2px;
  border-top: 2px solid currentColor;
  content: "";
}

.suitcase-icon {
  top: 3px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.suitcase-icon::before {
  position: absolute;
  top: -6px;
  left: 5px;
  width: 6px;
  height: 5px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  content: "";
}

.chart-icon {
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
}

.chart-icon::before {
  position: absolute;
  right: 2px;
  bottom: 3px;
  left: 3px;
  height: 11px;
  border-bottom: 2px solid currentColor;
  transform: skewY(-38deg);
  content: "";
}

.settings-icon {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.settings-icon::after {
  position: absolute;
  inset: 5px;
  border: 2px solid currentColor;
  border-radius: 50%;
  content: "";
}

.toast {
  position: fixed;
  z-index: 60;
  right: 18px;
  bottom: 92px;
  left: 18px;
  max-width: 500px;
  margin: auto;
  padding: 13px 16px;
  border-radius: 13px;
  background: #1c2732;
  color: white;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.modal-root.open {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(17, 25, 33, 0.42);
  backdrop-filter: blur(3px);
}

.sheet {
  width: min(100%, 760px);
  max-height: 90vh;
  padding: 9px 18px calc(22px + env(safe-area-inset-bottom));
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  background: white;
  box-shadow: 0 -14px 40px rgba(14, 25, 36, 0.16);
  animation: sheet-in 0.22s ease-out;
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 18px;
  border-radius: 10px;
  background: #d8dde2;
}

.sheet h2 {
  margin: 0 0 5px;
  font-size: 23px;
}

.sheet .subtitle {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.detail-block {
  margin: 12px 0;
  padding: 14px;
  border-radius: 15px;
  background: var(--surface-soft);
}

.detail-row {
  min-height: 40px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row span {
  color: var(--muted);
}

.form-field {
  display: grid;
  gap: 6px;
  margin: 13px 0;
}

.form-field label {
  font-size: 11px;
  font-weight: 800;
}

.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.form-section {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-soft);
}

.form-section .form-field:first-child {
  margin-top: 0;
}

.form-section .form-field:last-of-type {
  margin-bottom: 12px;
}

.conditional-field {
  display: none;
}

.conditional-field.visible {
  display: grid;
}

.delete-help {
  margin: -5px 0 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.delete-options {
  display: grid;
  gap: 9px;
}

.delete-option {
  display: flex;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  align-items: center;
  justify-content: space-between;
  color: white;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.delete-option small {
  font-size: 11px;
  opacity: 0.8;
}

.form-field input,
.form-field select,
.form-field textarea {
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.form-field textarea {
  min-height: 118px;
  padding-top: 12px;
  font: inherit;
  resize: vertical;
}

.sheet-actions {
  margin-top: 18px;
}

.sheet-actions button {
  flex: 1;
}

.auth-error {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--red);
  font-size: 12px;
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.full-button {
  width: 100%;
}

.empty-state {
  padding: 38px 22px;
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 7px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

@keyframes sheet-in {
  from {
    transform: translateY(30px);
    opacity: 0.6;
  }
}

@media (min-width: 600px) {
  .page {
    padding-right: 22px;
    padding-left: 22px;
  }

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

  .day-cell {
    min-height: 78px;
  }

  .segment,
  .segment small {
    font-size: 8px;
  }

  .year-grid {
    gap: 11px;
  }

  .mini-month {
    padding: 10px 8px;
  }

  .mini-day {
    width: min(100%, 22px);
    height: 22px;
    font-size: 7px;
  }
}
