:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f6f6;
  color: #222;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f6f6f6;
  color: #222;
}

.app {
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: 90px;
  background: #f6f6f6;
}

.topbar {
  height: 84px;
  padding: 20px 14px 10px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: end;
  background: #f6f6f6;
  border-bottom: 1px solid #e8e8e8;
}

.month-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.month-nav-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #888;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  margin: 0;
  padding: 0;
}

.month-nav-btn:hover {
  color: #f55e9b;
}

.month-nav-btn:focus-visible {
  outline: 2px solid #f55e9b;
  outline-offset: 1px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 28px;
  padding: 0;
}

.calendar-panel {
  padding: 8px 8px 0;
}

.calendar {
  min-height: 440px;
}

.calendar-head,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px 8px;
}

.calendar-head {
  margin-bottom: 12px;
  padding: 0 4px;
}

.calendar-weekday {
  text-align: center;
  color: #b3b3b3;
  font-size: 14px;
  line-height: 1;
}

.calendar-day {
  border: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: #202020;
  position: relative;
  line-height: 1;
}

.calendar-day .day-text {
  font-size: 15px;
  position: relative;
  z-index: 2;
}

.calendar-day.muted {
  color: #d4d4d4;
}

.calendar-day.period {
  color: #fff;
  background: #f55e9b;
}

.calendar-day.predicted {
  color: #fff;
  background: #efb3cf;
}

.calendar-day.ovulation {
  color: #fff;
  background: #c9b6ef;
}

.calendar-day.today {
  outline: 6px solid #b8e2f8;
  outline-offset: 2px;
}

.calendar-day.selected {
  box-shadow: inset 0 0 0 2px #7c3aed;
}

.calendar-day.start::after {
  content: "◔";
  position: absolute;
  bottom: -12px;
  font-size: 14px;
  color: #f55e9b;
}

.legend-bar {
  margin-top: 14px;
  padding: 12px 10px;
  background: #ececec;
  border-top: 1px solid #e2e2e2;
  border-bottom: 1px solid #e2e2e2;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 16px;
  color: #555;
  white-space: nowrap;
  overflow-x: auto;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 6px;
  vertical-align: -1px;
}

.dot.period {
  background: #f55e9b;
}

.dot.predicted {
  background: #efb3cf;
}

.dot.fertile {
  background: #c9b6ef;
}

.status-row {
  margin-top: 10px;
  padding: 16px 14px;
  background: #f1f1f1;
  border-top: 1px solid #e5e5e5;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calendar-action-row {
  margin-top: 8px;
  padding: 12px 14px;
  background: #f8f8f8;
  border-top: 1px solid #e5e5e5;
  border-bottom: 1px solid #e5e5e5;
}

.calendar-action-text {
  margin: 0;
  color: #555;
  font-size: 14px;
}

.calendar-action-buttons {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-text {
  margin: 0;
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.status-text strong {
  color: #f55e9b;
  font-size: 20px;
  font-weight: 600;
}

.status-text span {
  color: #999;
  font-size: 14px;
}

.text-btn {
  width: auto;
  margin-top: 0;
  background: #fff;
  border: 1px solid #f55e9b;
  color: #f55e9b;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.05s ease;
}

.text-btn:hover {
  background: #f55e9b;
  color: #fff;
}

.text-btn:focus-visible {
  outline: 2px solid #f55e9b;
  outline-offset: 2px;
}

.text-btn:active {
  transform: translateY(1px);
}


.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: 76px;
  background: #fff;
  border-top: 1px solid #e8e8e8;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.nav-item {
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #888;
  padding-top: 8px;
}

.nav-item span {
  font-size: 14px;
  margin-top: 4px;
}

.nav-item.active {
  color: #f55e9b;
}

.card {
  margin: 12px;
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 10px;
}

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

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

label {
  font-size: 14px;
  color: #666;
  display: block;
}

input,
select,
button {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}

.card button {
  border: none;
  background: #f55e9b;
  color: #fff;
}

ul {
  margin: 0;
  padding-left: 18px;
}

.status {
  min-height: 20px;
  color: #3b82f6;
}

.status.error {
  color: #dc2626;
}

.hidden {
  display: none;
}

.sw-update-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 406px;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  z-index: 1000;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.sw-update-banner span {
  font-size: 14px;
  color: #444;
}

.sw-update-action {
  width: auto;
  margin-top: 0;
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  background: #f55e9b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.sw-update-action:disabled {
  opacity: 0.7;
}

@media (max-width: 390px) {
  .month-title {
    font-size: 20px;
  }

  .status-text strong {
    font-size: 22px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .legend-bar {
    gap: 10px;
    font-size: 14px;
  }
}

.chart-page {
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: #f5f5f5;
}

.chart-header {
  height: 76px;
  padding: 16px 10px 0;
  border-bottom: 1px solid #e8e8e8;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  background: #f5f5f5;
}

.chart-back-btn {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  font-size: 36px;
  line-height: 1;
  color: #222;
  padding: 0;
  margin-top: 2px;
}

.chart-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-items: center;
}

.chart-tab {
  width: auto;
  margin: 0;
  padding: 0 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #111;
  font-size: 18px;
  line-height: 1;
}

.chart-nav {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid #e8e8e8;
  background: #fff;
}

.chart-nav-btn {
  width: auto;
  min-width: 54px;
  height: 28px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid #e0e0e0;
  border-radius: 999px;
  background: #fff;
  color: #444;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chart-nav-btn:disabled {
  opacity: 0.45;
}

.chart-nav-text {
  margin: 0;
  text-align: center;
  color: #666;
  font-size: 13px;
}

.chart-tab.active {
  color: #f55e9b;
  border-bottom-color: #f55e9b;
}

.chart-top-tags,
.chart-bottom-tags,
.chart-dates {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  text-align: center;
}

.chart-top-tags {
  border-bottom: 1px solid #e8e8e8;
  padding: 14px 10px;
  font-size: 16px;
}

.chart-top-tags .active,
.chart-bottom-tags .active {
  justify-self: center;
  color: #fff;
  background: #b284d9;
  border-radius: 999px;
  padding: 1px 10px;
  line-height: 1.2;
}

.chart-board {
  border-bottom: 1px solid #e8e8e8;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.grid-line {
  stroke: #e6e6e6;
  stroke-width: 1;
}

.line-cycle {
  fill: none;
  stroke: #a869d1;
  stroke-width: 1.6;
}

.line-period {
  fill: none;
  stroke: #ff4d92;
  stroke-width: 1.6;
}

.focus-line {
  stroke: #b48f9d;
  stroke-width: 1;
}

.node-cycle circle,
.node-period circle {
  fill: currentColor;
}

.node-cycle {
  color: #a869d1;
}

.node-period {
  color: #ff4d92;
}

.node-cycle .focus-ring,
.node-period .focus-ring {
  fill: none;
  stroke: currentColor;
  stroke-opacity: 0.25;
  stroke-width: 10;
}

.label-cycle,
.label-period,
.line-name-cycle,
.line-name-period {
  font-size: 12px;
}

.label-cycle {
  fill: #333;
}

.label-period {
  fill: #333;
}

.line-name-cycle {
  fill: #a869d1;
}

.line-name-period {
  fill: #ff4d92;
}

.chart-bottom-tags {
  padding: 8px 10px 4px;
  font-size: 16px;
}

.chart-bottom-tags .active {
  background: #ff5d98;
}

.chart-dates {
  padding: 8px 10px 10px;
  border-top: 1px solid #ececec;
  font-size: 13px;
  color: #3b3b3b;
}

.chart-selectable {
  cursor: pointer;
}

.chart-selectable:focus-visible {
  outline: 2px solid #f55e9b;
  outline-offset: 1px;
  border-radius: 8px;
}

.point-hit {
  fill: transparent;
  cursor: pointer;
}

.chart-dates .active {
  position: relative;
}

.chart-dates .active::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -10px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid #f7d9e3;
}

.chart-summary {
  background: #f7d9e3;
  color: #ff4d92;
  padding: 14px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
}

.chart-summary p {
  margin: 0;
}

.chart-summary .date {
  margin-bottom: 6px;
}

.chart-summary .summary-left p,
.chart-summary .summary-right p {
  line-height: 1.25;
}

.chart-summary .summary-right {
  text-align: right;
}

.chart-summary .summary-right p + p {
  margin-top: 6px;
}

.chart-details {
  margin-top: 10px;
  background: #fff;
  padding: 14px;
  border-top: 1px solid #e8e8e8;
}

.chart-details-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.chart-details-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
}

.chart-details-head span {
  font-size: 17px;
}

.chart-details-head .info {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #ff4d92;
  color: #ff4d92;
  font-style: normal;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chart-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  font-size: 16px;
  color: #222;
}

.chart-details-grid p {
  margin: 0;
}

.data-stats {
  background: #f5f5f5;
  padding: 12px 8px 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  row-gap: 16px;
}

.data-stat-item {
  text-align: center;
}

.data-stat-item .label {
  margin: 0;
  color: #1e1e1e;
  font-size: 16px;
  line-height: 1.2;
}

.data-stat-item .value {
  margin: 10px 0 0;
  color: #ff4d92;
  font-size: 20px;
  line-height: 1;
}

.data-splitter {
  height: 16px;
  background: #ececec;
}

.data-table {
  background: #fff;
  border-top: 1px solid #ececec;
}

.data-table-head,
.data-table-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  align-items: center;
  column-gap: 8px;
  padding: 0 12px;
}

.data-table-head {
  height: 70px;
  color: #171717;
  font-size: 14px;
  border-bottom: 1px solid #ececec;
}

.data-table-row {
  min-height: 72px;
  color: #222;
  font-size: 15px;
  border-bottom: 1px solid #ececec;
}

.data-table-head span:nth-child(2),
.data-table-head span:nth-child(3),
.data-table-row span:nth-child(2),
.data-table-row span:nth-child(3) {
  text-align: center;
}

.data-table-row span:nth-child(3) {
  text-align: right;
}

.data-pagination {
  height: 56px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #ececec;
}

.data-page-btn {
  width: auto;
  min-width: 54px;
  height: 28px;
  margin-top: 0;
  padding: 0 10px;
  border: 1px solid #e3e3e3;
  border-radius: 999px;
  background: #fff;
  color: #444;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.data-page-btn:disabled {
  opacity: 0.45;
}

.data-page-text {
  color: #666;
  font-size: 14px;
}