.planner-shell {
  width: min(2200px, 100%);
}

.planner-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}

.planner-view-switch,
.planner-year-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 18, 21, 0.34);
  padding: 3px;
}

.planner-view-button {
  min-height: 26px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  padding: 0 10px;
}

.planner-view-button.active,
.planner-view-button:hover,
.planner-view-button:focus-visible {
  border-color: rgba(233, 180, 93, 0.56);
  background: rgba(233, 180, 93, 0.12);
  color: var(--ink);
}

.planner-year-control strong {
  min-width: 56px;
  color: var(--ink);
  font-size: 0.82rem;
  text-align: center;
}

.planner-year-control span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  padding: 0 4px 0 6px;
}

.planner-year-control .secondary-button {
  min-height: 24px;
  padding: 0 8px;
}

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

.weekly-view {
  display: grid;
  grid-template-rows: minmax(250px, 1fr) minmax(250px, 1fr);
  gap: 8px;
  min-height: calc(100vh - 196px);
}

.week-panel,
.month-pair {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.022)),
    rgba(8, 31, 34, 0.78);
}

.week-heading,
.month-pair-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
}

.week-heading span,
.month-pair-heading span {
  color: var(--gold);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.week-heading strong,
.month-pair-heading strong {
  color: var(--ink);
  font-size: 0.78rem;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  height: calc(100% - 34px);
}

.day-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  border-right: 1px solid rgba(246, 240, 232, 0.08);
  padding: 6px;
}

.day-column:last-child {
  border-right: 0;
}

.day-column.weekend {
  background: rgba(167, 139, 250, 0.055);
}

.day-column.today {
  background:
    linear-gradient(180deg, rgba(233, 180, 93, 0.13), transparent),
    rgba(8, 31, 34, 0.44);
}

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 5px;
}

.day-head strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.76rem;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-head span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 820;
  white-space: nowrap;
}

.day-items {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.plan-card,
.year-event {
  border: 1px solid rgba(246, 240, 232, 0.12);
  border-left: 4px solid rgba(233, 180, 93, 0.8);
  border-radius: 6px;
  background: rgba(246, 240, 232, 0.055);
  color: var(--ink);
  text-align: left;
}

.plan-card {
  display: grid;
  gap: 2px;
  min-height: 36px;
  padding: 5px 6px;
}

.plan-card:hover,
.plan-card:focus-visible,
.year-event:hover,
.year-event:focus-visible {
  border-color: rgba(233, 180, 93, 0.58);
  background: rgba(233, 180, 93, 0.12);
}

.plan-card strong {
  overflow: hidden;
  font-size: 0.68rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-card span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-card.chess,
.year-event.chess {
  border-left-color: #60ddff;
}

.plan-card.travel,
.year-event.travel {
  border-left-color: #7fd66b;
}

.plan-card.family,
.year-event.family {
  border-left-color: #ffcf6a;
}

.plan-card.work,
.year-event.work {
  border-left-color: #a78bfa;
}

.plan-card.health,
.year-event.health {
  border-left-color: #ed7566;
}

.plan-card.done,
.plan-card.cancelled,
.year-event.done,
.year-event.cancelled {
  opacity: 0.54;
}

.add-day-plan {
  min-height: 24px;
  margin-top: 6px;
  border: 1px dashed rgba(246, 240, 232, 0.18);
  border-radius: 6px;
  background: rgba(5, 18, 21, 0.34);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  padding: 0 6px;
}

.add-day-plan:hover,
.add-day-plan:focus-visible {
  border-color: rgba(233, 180, 93, 0.6);
  color: var(--ink);
}

.yearly-view {
  overflow-x: auto;
  padding-bottom: 10px;
}

.year-grid {
  display: grid;
  gap: 8px;
  min-width: 1320px;
}

.month-pair {
  overflow: hidden;
}

.month-pair-heading {
  padding-right: 10px;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(var(--total-days), minmax(20px, 1fr));
  gap: 0;
  padding: 0 8px 8px;
}

.month-title,
.year-day,
.year-weekday,
.year-event {
  min-width: 0;
}

.month-title {
  border-bottom: 1px solid rgba(246, 240, 232, 0.14);
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 900;
  padding: 5px 2px;
  text-align: center;
}

.year-day,
.year-weekday {
  border-right: 1px solid rgba(246, 240, 232, 0.055);
  color: var(--ink);
  font-size: 0.56rem;
  font-weight: 840;
  line-height: 1.2;
  padding: 2px 0;
  text-align: center;
}

.year-day {
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
}

.year-day:hover,
.year-day:focus-visible {
  background: rgba(233, 180, 93, 0.16);
  color: #ffe1a1;
}

.year-weekday {
  border-bottom: 1px solid rgba(246, 240, 232, 0.14);
  color: var(--muted);
  font-size: 0.5rem;
  padding-bottom: 5px;
}

.year-day.weekend,
.year-weekday.weekend {
  background: rgba(167, 139, 250, 0.08);
}

.year-day.today,
.year-weekday.today {
  background: rgba(233, 180, 93, 0.18);
  color: #ffe1a1;
}

.year-event {
  overflow: hidden;
  margin-top: 4px;
  min-height: 28px;
  border-color: rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
    rgba(233, 180, 93, 0.22);
  box-shadow:
    0 5px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #fff8e8;
  padding: 5px 7px;
  font-size: 0.64rem;
  font-weight: 920;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.year-event.chess {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
    rgba(42, 174, 214, 0.28);
}

.year-event.travel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
    rgba(127, 214, 107, 0.24);
}

.year-event.family {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
    rgba(255, 207, 106, 0.25);
}

.year-event.work {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
    rgba(167, 139, 250, 0.3);
}

.year-event.health {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
    rgba(237, 117, 102, 0.3);
}

.year-event.empty-row {
  visibility: hidden;
}

.planner-dialog {
  width: min(600px, calc(100vw - 24px));
}

.planner-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.planner-form-grid label {
  display: grid;
  gap: 5px;
}

.danger-button {
  border-color: rgba(237, 117, 102, 0.38);
  color: #ffd0c8;
}

.empty-plan-state {
  border: 1px dashed rgba(246, 240, 232, 0.16);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.64rem;
  padding: 8px;
  text-align: center;
}

@media (max-width: 900px) {
  .planner-toolbar,
  .week-heading,
  .month-pair-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .weekly-view {
    min-height: auto;
  }

  .week-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .day-column {
    min-height: 130px;
    border-right: 0;
    border-bottom: 1px solid rgba(246, 240, 232, 0.08);
  }

  .planner-form-grid {
    grid-template-columns: 1fr;
  }
}
