/* stage-63-dashboard-rhythm */
.app-shell {
  --focus-dashboard-shell-width: 1500px;
  --focus-dashboard-rhythm-gap: clamp(16px, 1.55vw, 24px);
  --focus-dashboard-calendar-min: clamp(600px, 50vw, 720px);
  --focus-dashboard-rail-width: minmax(292px, 336px);
  --focus-dashboard-top-date: minmax(190px, 232px);
  --focus-dashboard-top-add: minmax(156px, 190px);
}

.main-surface {
  width: min(100%, var(--focus-dashboard-shell-width));
  gap: var(--focus-dashboard-rhythm-gap) !important;
  align-content: start;
}

.topbar {
  margin-bottom: 0;
}

.top-actions {
  display: grid !important;
  grid-template-columns:
    var(--focus-dashboard-top-date)
    minmax(360px, 1fr)
    var(--focus-dashboard-top-add);
  gap: var(--focus-dashboard-rhythm-gap) !important;
  align-items: stretch;
}

.top-actions :where(.current-date, .quote-dock, .add-menu-wrap) {
  min-width: 0;
}

.top-actions .quote-dock {
  min-height: clamp(74px, 5.8vw, 94px);
}

.top-actions .current-date,
.top-actions .top-add-button {
  min-height: clamp(66px, 5vw, 86px);
}

.add-menu-wrap {
  display: grid;
  align-items: stretch;
}

.top-add-button {
  width: 100%;
  justify-content: center;
}

.focus-dashboard {
  grid-template-columns: minmax(620px, 1fr) var(--focus-dashboard-rail-width);
  gap: var(--focus-dashboard-rhythm-gap) !important;
  align-items: start !important;
  max-width: 100%;
}

.dashboard-main {
  gap: clamp(12px, 1.1vw, 16px) !important;
  align-content: start;
}

.dashboard-main .calendar-sheet {
  width: 100%;
  min-height: var(--focus-dashboard-calendar-min);
  max-height: none;
}

.dashboard-rail {
  width: 100%;
  max-width: 336px !important;
  gap: clamp(14px, 1.2vw, 18px) !important;
  align-self: start;
  align-content: start;
  grid-auto-rows: max-content;
}

.dashboard-rail :where(.focus-summary-card, .focus-tasks-card) {
  min-height: auto !important;
  height: auto !important;
  align-self: start;
}

.dashboard-rail .focus-summary-card {
  max-height: max-content;
}

.dashboard-rail .focus-tasks-card {
  max-height: max-content;
}

.focus-tasks-card .plan-content {
  max-height: min(34vh, 300px);
  overflow: auto;
  padding-right: 2px;
}

.focus-tasks-card .plan-content:empty {
  display: none;
}

.focus-tasks-card .focus-tasks-action {
  margin-top: clamp(8px, 0.8vw, 12px) !important;
}

.interesting-today {
  margin-top: 0;
  width: min(100%, 1120px);
  justify-self: center;
}

.interesting-grid {
  align-items: stretch;
}

@media (max-width: 1180px) {
  .app-shell {
    --focus-dashboard-calendar-min: clamp(560px, 58vw, 680px);
    --focus-dashboard-rail-width: minmax(272px, 320px);
  }

  .top-actions {
    grid-template-columns:
      minmax(180px, 220px)
      minmax(300px, 1fr)
      minmax(148px, 176px);
  }

  .focus-dashboard {
    grid-template-columns: minmax(560px, 1fr) var(--focus-dashboard-rail-width);
  }
}

@media (max-width: 900px) {
  .app-shell {
    --focus-dashboard-calendar-min: auto;
  }

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

  .top-actions .add-menu-wrap {
    order: 3;
  }

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

  .dashboard-rail {
    max-width: 100% !important;
  }

  .dashboard-rail .focus-tasks-card {
    order: 1;
  }

  .dashboard-rail .focus-summary-card {
    order: 2;
  }

  .dashboard-main {
    order: 2;
  }
}

@media (max-width: 760px) {
  .app-shell {
    --focus-dashboard-rhythm-gap: 14px;
    --focus-dashboard-mobile-nav-clearance: calc(var(--focus-mobile-nav-height, 74px) + 24px + env(safe-area-inset-bottom));
  }

  .main-surface {
    gap: var(--focus-dashboard-rhythm-gap) !important;
  }

  .top-actions {
    gap: 12px !important;
  }

  .top-actions .quote-dock,
  .top-actions .current-date,
  .top-actions .top-add-button {
    min-height: auto;
  }

  .focus-dashboard {
    gap: var(--focus-dashboard-rhythm-gap) !important;
    padding-bottom: var(--focus-dashboard-mobile-nav-clearance);
  }

  .focus-tasks-card .plan-content {
    max-height: none;
    overflow: visible;
  }

  .interesting-today {
    width: 100%;
    margin-bottom: var(--focus-dashboard-mobile-nav-clearance);
  }
}

@media (prefers-reduced-motion: reduce) {
  .main-surface,
  .top-actions,
  .focus-dashboard,
  .dashboard-main,
  .dashboard-rail,
  .dashboard-main .calendar-sheet,
  .interesting-today {
    transition: none !important;
  }
}
