@font-face {
  font-family: "Instrument Serif";
  src: url("../src/assets/fonts/InstrumentSerif-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../src/assets/fonts/InstrumentSerif-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

.ds-root {
  --ds-ink: #111;
  --ds-secondary: #666;
  --ds-rule: #dedede;
  --ds-control-border: #767676;
  --ds-paper: #fff;
  --ds-surface: #f5f5f5;
  --ds-empty: #eee;
  --ds-serif: "Instrument Serif", Georgia, serif;
  --ds-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  position: relative;
  margin: -8px;
  min-height: 100vh;
  color: var(--ds-ink);
  background: var(--ds-paper);
  @apply type-body;
  font-family: var(--ds-sans);
  -webkit-font-smoothing: antialiased;
}
.ds-root *,
.ds-root *::before,
.ds-root *::after {
  box-sizing: border-box;
}
.ds-root :where(h1, h2, h3, h4, p, figure) {
  margin: 0;
}
.ds-root :where(h1) { @apply type-display; }
.ds-root :where(h2) { @apply type-section; }
.ds-root :where(h3, h4) { @apply type-title; }
.ds-root :where(small) { @apply type-small; }
.ds-root :where(a) {
  color: inherit;
  text-decoration: none;
}
.ds-root a:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}
.ds-root :where(button, input, select, textarea) {
  font: inherit;
  border-radius: 0;
}
.ds-root button {
  cursor: pointer;
}
.ds-root button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}
.ds-root :focus-visible {
  outline: 2px solid var(--ds-ink);
  outline-offset: 5px;
}
.ds-root section {
  scroll-margin-top: 28px;
}
.ds-muted,
.ds-code,
.ds-footnote {
  color: var(--ds-secondary);
}
.ds-code {
  @apply type-small;
  font-family: ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
}
.ds-eyebrow {
  @apply type-eyebrow;
  color: var(--ds-secondary);
}
.ds-header {
  max-width: 1280px;
  margin: auto;
  padding: 28px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--ds-rule);
}
.ds-wordmark {
  font-family: var(--ds-serif);
  @apply type-title;
  letter-spacing: -1.2px;
}
.ds-header nav {
  display: flex;
  gap: 30px;
  @apply type-small;
}
.ds-edition {
  color: var(--ds-secondary);
  @apply type-small;
  letter-spacing: 0.12em;
}
.ds-main {
  max-width: 1184px;
  padding: 0 48px;
  margin: auto;
}
.ds-library-label,
.ds-library-note {
  @apply type-small;
  color: var(--ds-secondary);
}
.ds-library-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 36px 0 28px;
}
.ds-library-intro h1 {
  @apply type-section;
  font-family: var(--ds-serif);
  font-weight: 400;
  margin: 10px 0;
}
.ds-library-intro p:not(.ds-eyebrow) { color: var(--ds-secondary); }
.ds-library-note { max-width: 180px; text-align: right; }
.ds-welcome-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 48px;
  margin: 36px 0 40px;
  padding: 40px;
  background: var(--ds-surface);
}
.ds-welcome-content { min-width: 0; }
.ds-welcome-identity { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.ds-avatar {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--ds-empty);
  @apply type-title;
}
.ds-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ds-welcome-content h1 { overflow-wrap: anywhere; }
.ds-welcome-content h1 em { display: block; }
.ds-welcome-subtitle { margin-top: 12px !important; color: var(--ds-secondary); @apply type-lead; }
.ds-welcome-progress { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 28px; color: var(--ds-secondary); }
.ds-welcome-progress > .type-title { color: var(--ds-ink); white-space: nowrap; }
.ds-welcome-complete { display: block; @apply type-small; }
.ds-welcome-content .ds-actions { margin-top: 24px; }
.ds-welcome-calendar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding-left: 40px;
  border-left: 1px solid var(--ds-rule);
  text-align: center;
}
.ds-date-sheet { display: flex; flex-direction: column; }
.ds-date-month { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--ds-rule); @apply type-small; }
.ds-date-number { padding-top: 24px; }
.ds-date-weekday { margin-top: 4px; @apply type-lead; }
.ds-date-caption { padding: 24px 0; border-bottom: 1px solid var(--ds-rule); }
.ds-welcome-timezone { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px !important; color: var(--ds-secondary); @apply type-small; }
.ds-welcome-timezone svg { flex-shrink: 0; }
.ds-welcome-timezone span { overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .ds-welcome-panel { grid-template-columns: minmax(0, 1fr) 220px; gap: 28px; padding: 28px; }
  .ds-welcome-calendar { padding-left: 28px; }
}
@media (max-width: 700px) {
  .ds-welcome-panel { grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 24px; margin-top: 24px; }
  .ds-welcome-calendar { padding: 28px 0 0; border-left: 0; border-top: 1px solid var(--ds-rule); }
  .ds-date-sheet { width: 100%; max-width: 280px; align-self: center; }
}
.ds-tab-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  background: var(--ds-surface);
}
.ds-tab-bar [role="tab"] {
  @apply type-body;
  background: transparent;
  color: var(--ds-secondary);
  border: 1px solid transparent;
  padding: 10px 8px;
}
.ds-tab-bar [role="tab"]:hover { background: var(--ds-surface); color: var(--ds-ink); }
.ds-tab-bar [aria-selected="true"] {
  background: var(--ds-paper);
  color: var(--ds-ink);
  border-color: var(--ds-rule);
}
.ds-tab-bar [role="tab"]:focus-visible { outline-offset: -3px; }
.ds-tab-panel { min-width: 0; min-height: 420px; }
.ds-tab-panel[hidden] { display: none; }
.ds-tab-panel > .ds-section { border-top: 0; }
@media (max-width: 1000px) {
  .ds-tab-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .ds-library-intro { display: block; padding: 28px 0 24px; }
  .ds-library-note { display: block; max-width: none; text-align: left; margin-top: 16px; }
  .ds-tab-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.ds-header nav { flex-wrap: wrap; }
.ds-header nav [aria-current="page"] { text-decoration: underline; text-underline-offset: 5px; }
.ds-account-controls { padding: 24px 0; border-top: 1px solid var(--ds-rule); }
.ds-account-controls p { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.ds-account-controls [role="alert"] { margin-top: 16px; }
.ds-type-scale { list-style: none; padding: 0; margin: 24px 0; }
.ds-type-scale li { display: grid; gap: 8px; padding: 20px 0; border-top: 1px solid var(--ds-rule); }
.ds-type-scale code { @apply type-small; color: var(--ds-secondary); overflow-wrap: anywhere; }
.ds-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  padding: 85px 0 72px;
}
.ds-intro h1 {
  @apply type-display;
  margin: 23px 0 26px;
}
.ds-intro h1 em {
  font-weight: 400;
}
.ds-intro-copy {
  @apply type-body;
  color: var(--ds-secondary);
}
.ds-intro-note {
  width: 220px;
  padding-bottom: 4px;
  @apply type-small;
}
.ds-tiny-cross {
  display: block;
  @apply type-title;
  font-weight: 200;
  margin-bottom: 20px;
}
.ds-intro-note p {
  color: var(--ds-secondary);

  margin-bottom: 29px;
}
.ds-intro-note a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--ds-ink);
}
.ds-section {
  padding: 42px 0 56px;
  border-top: 1px solid var(--ds-rule);
}
.ds-section-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 32px;
}
.ds-section-top h2 {
  @apply type-section;
  margin-top: 15px;
}
.ds-section-top > p {
  @apply type-small;
}
.ds-demo-note {
  color: var(--ds-secondary);
  @apply type-small;
  white-space: normal;
}
.ds-demo-note > span {
  @apply type-lead;
  vertical-align: -1px;
  padding-right: 4px;
}
.ds-preview-toolbar {
  display: flex;
  justify-content: space-between;
}
.ds-view-switch {
  display: flex;
  gap: 28px;
}
.ds-view-switch button {
  background: transparent;
  color: var(--ds-secondary);
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 13px 0;
  @apply type-small;
}
.ds-view-switch button[aria-pressed="true"] {
  border-bottom-color: var(--ds-ink);
  color: var(--ds-ink);
}
.ds-preview-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: 32px 0 22px;
}
.ds-preview-heading h3 {
  font-family: var(--ds-serif);
  @apply type-title;
  margin-top: 8px;
}
.ds-preview-heading > p {
  color: var(--ds-secondary);
  @apply type-small;
  padding-bottom: 4px;
}
.ds-habit-row {
  padding: 19px 0;
}
.ds-habit-row + .ds-habit-row {
  border-top: 1px solid var(--ds-rule);
}
.ds-habit-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.ds-habit-main h4 {
  font-family: var(--ds-serif);
  @apply type-title;
}
.ds-habit-main p {
  color: var(--ds-secondary);
  @apply type-small;
  margin-top: 3px;
}
.ds-habit-control {
  display: flex;
  align-items: center;
  gap: 25px;
}
.ds-status {
  color: var(--ds-secondary);
  min-width: 67px;
  @apply type-small;
  text-align: right;
}
.ds-button {
  min-height: 44px;
  border: 1px solid var(--ds-ink);
  padding: 10px 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  @apply type-body;
  background: var(--ds-ink);
  color: var(--ds-paper);
}
.ds-button:hover:not(:disabled) {
  background: var(--ds-secondary);
}
.ds-button-icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.ds-button--secondary {
  background: transparent;
  color: var(--ds-ink);
}
.ds-button--text {
  background: transparent;
  color: var(--ds-ink);
  border-color: transparent;
}
.ds-button--secondary:hover:not(:disabled),
.ds-button--text:hover:not(:disabled) {
  background: var(--ds-surface);
}
.ds-counter {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.ds-counter .ds-button {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  @apply type-control;
  font-weight: 300;
  padding: 0;
}
.ds-counter output {
  min-width: 41px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ds-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  cursor: pointer;
  @apply type-small;
}
.ds-checkbox input {
  appearance: none;
  margin: 0;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border: 1px solid var(--ds-control-border);
  background: var(--ds-paper);
  display: grid;
  place-content: center;
  cursor: pointer;
}
.ds-checkbox input:checked {
  background: var(--ds-ink);
  border-color: var(--ds-ink);
}
.ds-checkbox input:checked::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 1px solid var(--ds-paper);
  border-bottom: 1px solid var(--ds-paper);
  transform: rotate(-45deg) translateY(-1px);
}
.ds-checkbox input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ds-checkbox--icon {
  padding: 10px;
  min-width: 44px;
  justify-content: center;
}
.ds-checkbox--icon span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.ds-task-list {
  display: flex;
  gap: 28px;
  margin-top: 13px;
}
.ds-task-count {
  min-width: 149px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ds-footnote {
  @apply type-small;

  margin-top: 18px !important;
}
.ds-habits > .ds-footnote {
  border-top: 1px solid var(--ds-rule);
  padding-top: 17px;
  margin-top: 0 !important;
}
/* Flat surfaces group content; grid spans are only applied by a bento parent. */
.ds-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.ds-card-grid--bento {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.ds-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 24px;
  padding: 28px;
  border: 1px solid transparent;
  border-radius: 0;
  box-shadow: none;
  overflow-wrap: anywhere;
}
.ds-card--soft { background: var(--ds-surface); }
.ds-card--outlined {
  background: var(--ds-paper);
  border-color: var(--ds-rule);
}
.ds-card-title { @apply type-title; }
.ds-card-header .ds-eyebrow { margin-bottom: 12px; }
.ds-card-body { display: grid; gap: 20px; }
.ds-card-body > p { color: var(--ds-secondary); }
.ds-card-footer { margin-top: auto; }
.ds-card-summary { padding: 12px 0; }
.ds-card-summary > p + p { color: var(--ds-secondary); margin-top: 8px; }
.ds-card .ds-counter { justify-content: flex-start; flex-wrap: wrap; }
.ds-card-grid--bento > :is(.ds-card--wide, .ds-card--featured) { grid-column: span 2; }
.ds-card-grid--bento > .ds-card--featured { grid-row: span 2; }
.ds-container-showcase > .ds-section-heading { max-width: 720px; }
.ds-container-guidance { display: flex; align-items: start; gap: 32px; margin-top: 24px; }
.ds-container-guidance > p { flex: 1; margin-top: 0 !important; }
.ds-container-guidance > button { flex-shrink: 0; }
.ds-container-code { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 24px; }
@media (max-width: 1000px) {
  .ds-card-grid--bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ds-card-grid--bento > .ds-card--featured { grid-row: auto; }
}
@media (max-width: 600px) {
  .ds-card-grid { grid-template-columns: minmax(0, 1fr); }
  .ds-card-grid--bento > :is(.ds-card--wide, .ds-card--featured) { grid-column: auto; }
  .ds-card { padding: 24px; }
  .ds-container-guidance { flex-direction: column; gap: 12px; }
  .ds-container-showcase .ds-spec-heading { align-items: start; flex-direction: column; gap: 8px; }
}
.ds-split-section {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  column-gap: 60px;
  padding-top: 40px;
}
.ds-section-heading h2 {
  @apply type-section;
  margin-top: 17px;
}
.ds-section-heading p {
  color: var(--ds-secondary);
  @apply type-small;

  margin-top: 15px;
}
.ds-spec-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 23px;
}
.ds-spec-heading h3,
.ds-spec-heading label {
  @apply type-ui-heading;
}
.ds-spec-heading--spaced {
  margin-top: 36px;
}
.ds-type-display {
  display: block;
  font-family: var(--ds-serif);
  @apply type-display;
}
.ds-type-specimen p,
.ds-body-specimen p {
  @apply type-small;
  color: var(--ds-secondary);
  margin-top: 16px;
}
.ds-body-specimen {
  border-bottom: 1px solid var(--ds-rule);
  padding: 26px 0;
}
.ds-body-specimen > span {
  @apply type-body;
}
.ds-body-specimen p {
  margin-top: 6px;
}
.ds-palette {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.ds-swatch {
  height: 64px;
}
.ds-palette > div:last-child .ds-swatch {
  border: 1px solid var(--ds-rule);
}
.ds-palette p {
  @apply type-small;
  margin-top: 10px;
}
.ds-palette .ds-code {
  display: block;
  @apply type-small;
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.ds-spacing {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 30px;
}
.ds-spacing > div {
  display: grid;
  gap: 10px;
}
.ds-spacing span {
  height: 4px;
  background: var(--ds-ink);
}
.ds-spacing code {
  @apply type-small;
  color: var(--ds-secondary);
}
.ds-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding-bottom: 30px;
}
.ds-component-row {
  border-top: 1px solid var(--ds-rule);
  padding: 24px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.ds-component-row h3 {
  @apply type-ui-heading;
  margin-bottom: 8px;
}
.ds-example-form {
  border-top: 1px solid var(--ds-rule);
  padding-top: 26px;
}
.ds-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.ds-input-row input {
  flex: 1 1 12rem;
  min-width: 0;
}
.ds-input-row input::placeholder {
  color: var(--ds-secondary);
}
.ds-shade-scale {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 14px;
}
.ds-shade-scale > div {
  display: grid;
  gap: 10px;
}
.ds-shade-scale span {
  aspect-ratio: 1;
  max-height: 40px;
}
.ds-shade-scale small {
  color: var(--ds-secondary);
  @apply type-small;
}
.ds-scale-caption {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  @apply type-small;
  color: var(--ds-secondary);
  margin-top: 16px;
}
.ds-neutral-states {
  margin-top: 25px;
  border-top: 1px solid var(--ds-rule);
  padding-top: 25px;
  display: flex;
  gap: 36px;
}
.ds-neutral-states > div {
  display: flex;
  align-items: center;
  gap: 13px;
}
.ds-neutral-states h4 {
  @apply type-ui-heading;
}
.ds-neutral-states p {
  @apply type-small;
  color: var(--ds-secondary);
  margin-top: 8px;
}
.ds-state-square {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
}
.ds-state-square--future {
  background: var(--ds-empty);
}
.ds-reference-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
.ds-reference-grid a {
  display: block;
}
.ds-reference-grid img {
  width: 100%;
  height: auto;
  display: block;
}
.ds-reference-grid figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  @apply type-small;
  border-top: 1px solid var(--ds-rule);
  padding-top: 15px;
  margin-top: 20px;
}
.ds-footer {
  border-top: 1px solid var(--ds-rule);
  padding: 28px 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.ds-footer .ds-wordmark {
  @apply type-control;
}
.ds-footer > span:nth-child(2) {
  font-family: var(--ds-serif);
  font-style: italic;
  @apply type-lead;
  color: var(--ds-secondary);
}
.ds-footer a {
  @apply type-small;
}
.ds-detail-count {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--ds-rule);
  padding: 20px 0 30px;
}
.ds-big-value {
  font-family: var(--ds-serif);
  @apply type-display;
}
.ds-big-value small {
  @apply type-control;
  margin-left: 20px;
}
.ds-chart-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  padding: 4px 0 22px;
}
.ds-calendar {
  min-width: 0;
  container-type: inline-size;
  --calendar-gap: 4px;
}
/* Shared axes and consecutive weeks; landscape fits without a scroll container. */
.ds-calendar-viewport {
  padding: 4px;
}
.ds-calendar-timeline {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px 10px;
  width: 100%;
  max-width: calc(46px + var(--calendar-weeks) * 24px + (var(--calendar-weeks) - 1) * var(--calendar-gap));
}
.ds-calendar-months {
  display: grid;
  grid-column: 2;
  grid-template-columns: repeat(var(--calendar-weeks), minmax(0, 1fr));
  gap: var(--calendar-gap);
  min-width: 0;
}
.ds-calendar-range-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 18px;
}
.ds-calendar-range-label {
  @apply type-small;
  color: var(--ds-secondary);
}
.ds-month-views {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ds-calendar-custom-range {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 22px;
}
.ds-calendar-custom-range .ds-field {
  flex: 1 1 160px;
  margin-bottom: 0;
}
.ds-calendar-custom-range input { width: 100%; }
.ds-calendar-range-error {
  flex-basis: 100%;
  @apply type-small;
  color: var(--ds-ink);
}
.ds-month-views button {
  min-height: 44px;
  min-width: 44px;
  padding: 5px 7px;
  color: var(--ds-secondary);
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  @apply type-small;
}
.ds-month-views button:hover {
  color: var(--ds-ink);
  background: var(--ds-surface);
}
.ds-month-views button[aria-pressed="true"] {
  color: var(--ds-ink);
  border-bottom-color: var(--ds-ink);
}
.ds-calendar-month-label {
  min-width: 0;
  @apply type-small;
  color: var(--ds-secondary);
}
.ds-calendar-weekdays {
  display: grid;
  grid-column: 1;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  min-height: 0;
  height: 100%;
  contain: size;
  gap: var(--calendar-gap);
  @apply type-small;
  color: var(--ds-secondary);
  align-items: center;
}
.ds-calendar-weekdays span:nth-child(1) {
  grid-row: 2;
}
.ds-calendar-weekdays span:nth-child(2) {
  grid-row: 4;
}
.ds-calendar-weekdays span:nth-child(3) {
  grid-row: 6;
}
.ds-calendar-grid {
  display: grid;
  grid-column: 2;
  grid-template-columns: repeat(var(--calendar-weeks), minmax(0, 1fr));
  grid-template-rows: repeat(7, 1fr);
  min-width: 0;
  gap: var(--calendar-gap);
}
.ds-day {
  padding: 0;
  aspect-ratio: 1;
  border: 1px solid transparent;
  width: 100%;
  min-width: 0;
  min-height: 0;
}
/* Only narrow portrait screens scroll, preserving comfortable date targets. */
@media (max-width: 600px) and (orientation: portrait) {
  .ds-calendar-viewport { overflow-x: auto; }
  .ds-day { min-width: 24px; min-height: 24px; }
  .ds-calendar-timeline {
    min-width: calc(46px + var(--calendar-weeks) * 24px + (var(--calendar-weeks) - 1) * var(--calendar-gap));
  }
}
/* Reserve filled squares for tracked days. */
.ds-day--not-due,
.ds-legend-swatch--not-due,
.ds-state-square--not-due {
  position: relative;
  background: transparent;
}
.ds-day--not-due::after,
.ds-legend-swatch--not-due::after,
.ds-state-square--not-due::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ds-secondary);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.ds-day--not-due:hover {
  box-shadow: inset 0 0 0 1px var(--ds-rule);
}
.ds-day[aria-pressed="true"] {
  outline: 1px solid var(--ds-ink);
  outline-offset: 2px;
}
.ds-day:focus-visible {
  outline: 2px solid var(--ds-ink);
  outline-offset: 2px;
}
.ds-calendar-caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  @apply type-small;
  margin: 17px 0 23px;
}
.ds-calendar-legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 18px;
  color: var(--ds-secondary);
  @apply type-small;
}
.ds-legend-scale,
.ds-legend-neutral,
.ds-legend-swatches {
  display: inline-flex;
  align-items: center;
}
.ds-legend-scale,
.ds-legend-neutral {
  gap: 8px;
}
.ds-legend-swatches {
  gap: 3px;
}
.ds-legend-swatch {
  display: block;
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
}
/* Calendar detail and task controls share a compact, readable hierarchy. */
.ds-calendar-help { color: var(--ds-secondary); max-width: 30rem; }
.ds-calendar-help summary { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; list-style: none; }
.ds-calendar-help summary::-webkit-details-marker { display: none; }
.ds-calendar-help summary:hover { color: var(--ds-ink); }
.ds-calendar-help p { padding: 4px 0 12px; }
.ds-calendar-caption { align-items: baseline; margin-bottom: 16px; }
.ds-date-inspector {
  background: var(--ds-surface);
  border-left: 3px solid var(--calendar-color, var(--ds-ink));
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  @apply type-small;
}
.ds-date-inspector-heading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ds-date-inspector-heading > svg { flex-shrink: 0; color: var(--ds-secondary); }
.ds-date-inspector-heading time { display: block; margin-top: 3px; @apply type-ui-heading; }
.ds-date-inspector-status { display: block; margin-top: 4px; color: var(--ds-secondary); overflow-wrap: anywhere; }
.ds-skip-link {
  position: absolute;
  top: 0;
  left: 24px;
  padding: 10px;
  background: var(--ds-paper);
  transform: translateY(-110%);
  z-index: 2;
}
.ds-skip-link:focus {
  transform: translateY(0);
}
@media (max-width: 900px) {
  .ds-header {
    padding-inline: 32px;
  }
  .ds-main {
    padding-inline: 32px;
  }
  .ds-split-section {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 30px;
  }
  .ds-neutral-states {
    flex-direction: column;
    gap: 20px;
  }
  .ds-spacing {
    gap: 22px;
  }
  .ds-spec-heading {
    flex-wrap: wrap;
    gap: 5px;
  }
  .ds-intro-note {
    width: 185px;
  }
  .ds-edition {
    display: none;
  }
}
@media (max-width: 640px) {
  .ds-header {
    padding: 23px 22px;
    gap: 18px;
  }
  .ds-header nav {
    gap: 16px;
  }
  .ds-main {
    padding-inline: 22px;
  }
  .ds-intro {
    padding: 50px 0 44px;
  }
  .ds-intro-note {
    display: none;
  }
  .ds-section {
    padding: 30px 0 36px;
  }
  .ds-section-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
  }
  .ds-split-section {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
  }
  .ds-section-heading p br {
    display: initial;
  }
  .ds-view-switch {
    gap: 18px;
  }
  .ds-preview-toolbar > .ds-button {
    gap: 5px;
  }
  .ds-preview-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding-top: 25px;
  }
  .ds-habit-control {
    flex-direction: column;
    gap: 0;
    align-items: flex-end;
  }
  .ds-counter {
    gap: 2px;
  }
  .ds-counter .ds-button {
    width: 44px;
  }
  .ds-task-count {
    min-width: 106px;
    text-align: right;
    min-height: 36px;
  }
  .ds-task-list {
    flex-wrap: wrap;
    gap: 3px 20px;
  }
  .ds-palette {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
  }
  .ds-swatch {
    height: 58px;
  }
  .ds-shade-scale {
    gap: 8px;
  }
  .ds-reference-grid {
    grid-template-columns: 1fr;
    gap: 35px;
  }
  .ds-footer > span:nth-child(2) {
    display: none;
  }
  .ds-chart-selection {
    gap: 10px 18px;
  }
  .ds-calendar-caption { flex-direction: column; gap: 0; }
  .ds-big-value small {
    margin-left: 10px;
  }
  .ds-actions {
    gap: 12px;
  }
  .ds-input-row {
    gap: 10px;
  }
  .ds-input-row .ds-button {
    padding-inline: 14px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .ds-root :where(button, a, input) {
    transition:
      background-color 120ms ease,
      color 120ms ease;
  }
}

/* Habit charts share an open two-column grid, not card containers. */
.ds-habit-chart-grid {
  @apply type-small;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 38px 44px;
  align-items: start;
}
.ds-habit-chart {
  min-width: 0;
  padding-top: 20px;
}
.ds-habit-chart:nth-child(n + 3),
.ds-habit-chart:has(.ds-calendar:is([data-months="12"], [data-months="custom"])) + .ds-habit-chart {
  border-top: 1px solid var(--ds-rule);
}
.ds-habit-chart:has(.ds-calendar:is([data-months="12"], [data-months="custom"])) {
  grid-column: 1 / -1;
}
.ds-habit-chart-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.ds-habit-chart-heading > div {
  min-width: 0;
}
.ds-habit-chart-heading :is(h3, h4) {
  overflow-wrap: anywhere;
  font-family: var(--ds-serif);
  @apply type-title;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ds-habit-chart-heading :is(h3, h4) > span {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
}
.ds-habit-chart-heading p {
  color: var(--ds-secondary);
  @apply type-small;
  margin-top: 4px;
}
.ds-habit-chart-heading .ds-counter {
  gap: 4px;
}
.ds-habit-chart-heading .ds-counter .ds-button {
  width: 44px;
}
.ds-habit-chart-progress {
  display: flex;
  justify-content: space-between;
  color: var(--ds-secondary);
  @apply type-small;
  margin: 23px 0 20px !important;
}
.ds-habit-chart-grid-note {
  grid-column: 1 / -1;
  margin-top: -12px !important;
}
.ds-calendar--compact .ds-calendar-caption { margin-bottom: 12px; }
.ds-task-accordion {
  margin-top: 16px;
  border: 1px solid var(--ds-rule);
}
.ds-task-accordion > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 64px;
  padding: 16px 20px;
}
.ds-task-accordion > summary::-webkit-details-marker { display: none; }
.ds-task-accordion > summary:hover { background: var(--ds-surface); }
.ds-task-accordion > summary > svg { flex-shrink: 0; color: var(--ds-secondary); }
.ds-task-accordion-title { @apply type-ui-heading; }
.ds-task-accordion-progress { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--ds-secondary); @apply type-small; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ds-task-accordion-progress progress { appearance: none; width: 64px; height: 4px; border: 0; background: var(--ds-empty); color: var(--habit-color, var(--ds-ink)); }
.ds-task-accordion-progress progress::-webkit-progress-bar { background: var(--ds-empty); }
.ds-task-accordion-progress progress::-webkit-progress-value { background: var(--habit-color, var(--ds-ink)); }
.ds-task-accordion-progress progress::-moz-progress-bar { background: var(--habit-color, var(--ds-ink)); }
.ds-task-accordion[open] .ds-task-accordion-chevron { transform: rotate(180deg); }
.ds-task-accordion-content { display: grid; padding: 0 20px 8px; }
.ds-task-accordion-content .ds-checkbox { min-width: 0; min-height: 52px; padding: 12px 4px; gap: 12px; border-top: 1px solid var(--ds-rule); @apply type-body; }
.ds-task-accordion-content .ds-checkbox:hover { background: var(--ds-surface); }
.ds-task-accordion-content .ds-checkbox span { overflow-wrap: anywhere; }
.ds-task-accordion-content .ds-checkbox:has(input:checked) .ds-checkbox-label { color: var(--ds-secondary); text-decoration: line-through; text-decoration-color: var(--ds-control-border); }
.ds-task-accordion-content .ds-checkbox:has(input:disabled) { cursor: not-allowed; }
@media (max-width: 640px) {
  .ds-task-accordion > summary { padding: 14px 16px; gap: 10px; }
  .ds-task-accordion-content { padding-inline: 16px; }
  .ds-task-accordion-progress progress { display: none; }
}
.ds-habit-color-key {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.ds-habit-color-key > span {
  display: flex;
  align-items: center;
  gap: 9px;
  @apply type-small;
  text-transform: capitalize;
}
.ds-habit-color-key i {
  width: 10px;
  height: 10px;
}
@media (max-width: 760px) {
  .ds-split-section {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
  }
  .ds-habit-chart + .ds-habit-chart {
    border-top: 1px solid var(--ds-rule);
  }
  .ds-habit-chart-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }
  .ds-habit-chart-heading .ds-counter {
    gap: 8px;
  }
}

.ds-legend-scale { flex-wrap: wrap; }

/* Editing patterns use the same open layout, rules, and neutral controls. */
.ds-color-picker { border: 0; border-top: 1px solid var(--ds-rule); padding: 20px 0 0; margin: 26px 0; min-width: 0; }
.ds-color-picker legend { padding: 0 12px 0 0; @apply type-ui-heading; }
.ds-color-picker > .ds-footnote { margin-top: 0 !important; }
.ds-color-palettes { display: flex; flex-wrap: wrap; gap: 20px 28px; margin: 20px 0; }
.ds-color-palette > span { @apply type-small; color: var(--ds-secondary); }
.ds-color-swatches { display: flex; gap: 4px; margin-top: 8px; }
.ds-color-swatches button { display: grid; place-items: center; width: 44px; min-width: 44px; min-height: 44px; padding: 4px; border: 1px solid transparent; background: transparent; }
.ds-color-swatches button[aria-pressed="true"] { border-color: var(--ds-ink); }
.ds-color-swatches button > span { display: grid; place-content: center; height: 28px; width: 28px; color: var(--ds-paper); @apply type-body; }
.ds-custom-color { display: flex; flex-wrap: wrap; gap: 16px; align-items: start; }
.ds-custom-color .ds-field { margin-bottom: 0; }
.ds-custom-color .ds-field:last-child { width: 180px; }
.ds-custom-color input[type="color"] { width: 80px; height: 44px; padding: 5px; cursor: pointer; }
.ds-color-live-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 22px; @apply type-small; }
.ds-color-preview-shades { display: flex; gap: 4px; }
.ds-color-preview-shades > span { width: 18px; height: 18px; border: 1px solid var(--ds-rule); }
.ds-edit-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 72px;
  padding-top: 36px;
}
.ds-edit-context, .ds-edit-content { min-width: 0; }
.ds-edit-context h3 {
  font-family: var(--ds-serif);
  @apply type-title;
  margin: 16px 0;
}
.ds-edit-context > p { color: var(--ds-secondary); }
.ds-edit-context > .ds-field { margin-top: 30px; }
.ds-edit-meta { display: flex; align-items: center; gap: 10px; margin-top: 24px; overflow-wrap: anywhere; }
.ds-habit-dot { width: 8px; height: 8px; flex: 0 0 8px; }
.ds-field { display: grid; min-width: 0; gap: 8px; margin-bottom: 22px; }
.ds-field label, .ds-weekday-field legend { @apply type-ui-heading; }
.ds-field :is(input, select) {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--ds-control-border);
  padding: 10px 12px;
  font: inherit;
  @apply type-body;
  border-radius: 0;
  background: var(--ds-paper);
  color: var(--ds-ink);
}
.ds-field input[readonly] { border-color: var(--ds-rule); color: var(--ds-secondary); }
.ds-field small { @apply type-small; color: var(--ds-secondary); }
.ds-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.ds-form-section { border-top: 1px solid var(--ds-rule); padding-top: 24px; margin-top: 24px; }
.ds-edit-content .ds-checkbox { @apply type-small; }
.ds-weekday-field, .ds-task-editor-fieldset { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.ds-weekdays { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ds-weekdays button { min-height: 44px; min-width: 44px; padding: 8px; border: 1px solid var(--ds-control-border); background: var(--ds-paper); color: var(--ds-secondary); }
.ds-weekdays button[aria-pressed="true"] { color: var(--ds-paper); background: var(--ds-ink); border-color: var(--ds-ink); }
.ds-form-actions { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.ds-form-feedback { min-height: 24px; margin: 20px 0 12px !important; color: var(--ds-secondary); @apply type-small; overflow-wrap: anywhere; }
.ds-form-feedback[role="alert"] { border-left: 2px solid var(--ds-ink); padding-left: 12px; color: var(--ds-ink); }
.ds-save-notice { margin-bottom: 0 !important; }
.ds-edit-task { min-width: 0; margin: 0; border: 0; border-top: 1px solid var(--ds-rule); padding: 16px 0 10px; }
.ds-edit-task > legend { padding: 0 12px 0 0; @apply type-ui-heading; }
.ds-edit-task .ds-spec-heading { margin-bottom: 16px; }
.ds-empty-state { padding: 24px 0; color: var(--ds-secondary); }
.ds-history-requirement { display: flex; justify-content: space-between; gap: 16px; border-block: 1px solid var(--ds-rule); padding: 18px 0; margin-bottom: 24px; }
.ds-history-requirement > span { color: var(--ds-secondary); }
.ds-history-requirement strong { font-weight: 500; }
.ds-backfill-tasks { display: grid; gap: 8px; }
.ds-correction-summary { display: flex; justify-content: space-between; gap: 16px; margin-top: 22px !important; font-variant-numeric: tabular-nums; }
.ds-correction-summary span { color: var(--ds-secondary); }
.ds-backfill-calendar { border-top: 1px solid var(--ds-rule); margin-top: 32px; padding-top: 24px; }
.ds-correction-log { margin-top: 28px; border-top: 1px solid var(--ds-rule); padding-top: 24px; }
.ds-correction-log ol { list-style: none; margin: 0; padding: 0; }
.ds-correction-log li { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 16px; border-bottom: 1px solid var(--ds-rule); padding: 16px 0; @apply type-small; overflow-wrap: anywhere; }
.ds-correction-log time { color: var(--ds-secondary); }
#editing .ds-preview-toolbar { flex-wrap: wrap; gap: 0 16px; }
#editing .ds-view-switch { flex-wrap: wrap; gap: 0 24px; }
@media (max-width: 900px) {
  .ds-edit-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 32px; }
}
@media (max-width: 640px) {
  .ds-edit-layout { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .ds-form-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .ds-history-requirement { flex-wrap: wrap; }
  .ds-correction-log li { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  #editing .ds-view-switch { gap: 0 18px; }
}
@media (max-width: 640px) {
  .ds-header,
  .ds-preview-toolbar { flex-wrap: wrap; }
  .ds-view-switch { flex-wrap: wrap; gap: 0 18px; }
}

@media (forced-colors: active) {
  .ds-checkbox input {
    appearance: auto;
    background: Canvas;
    border-color: ButtonText;
  }
  .ds-checkbox input:checked::after { content: none; }
  .ds-root :is(button, input):disabled { color: GrayText; opacity: 1; }
  .ds-day { border-color: ButtonText; }
  .ds-day[aria-pressed="true"] { outline-color: Highlight; }
  .ds-tab-bar [aria-selected="true"],
  .ds-month-views [aria-pressed="true"],
  .ds-weekdays [aria-pressed="true"] { border-color: Highlight; }
}

/* Inline management keeps actions visible without competing with the habit. */
.ds-item-actions { display: inline-flex; flex: 0 0 auto; gap: 2px; align-items: center; }
.ds-item-actions .ds-icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; color: var(--ds-secondary); }
.ds-item-actions .ds-icon-button:hover { background: var(--ds-surface); color: var(--ds-ink); }
.ds-habit-title-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ds-habit-title-row :is(h3, h4) { min-width: 0; }
.ds-inline-item-form { padding: 20px; background: var(--ds-surface); margin: 16px 0; min-width: 0; }
.ds-inline-item-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.ds-inline-item-form--habit { max-width: 720px; }
.ds-inline-item-form--task { margin: 0 0 12px; padding: 16px; }
.ds-inline-item-form .ds-field input { min-width: 0; }
.ds-inline-form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.ds-inline-delete-copy { @apply type-small; overflow-wrap: anywhere; }
.ds-inline-item-form .ds-footnote { margin-top: 12px; }
.ds-editable-task { min-width: 0; border-top: 1px solid var(--ds-rule); }
.ds-editable-task-row { display: flex; align-items: center; gap: 12px; min-width: 0; padding-block: 4px; }
.ds-editable-task-row > .ds-checkbox { flex: 1; min-height: 76px; border-top: 0; }
.ds-checkbox-copy { display: grid; gap: 4px; min-width: 0; }
.ds-checkbox-description { color: var(--ds-secondary); @apply type-small; }
.ds-share-panel { margin-top: 32px; padding: 32px; border: 1px solid var(--ds-rule); }
.ds-share-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 32px; }
.ds-share-heading h2 { margin-top: 8px; }
.ds-share-heading > .ds-button { flex: 0 0 auto; padding: 12px; }
.ds-share-layout { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 36px; align-items: start; }
.ds-share-controls { display: grid; gap: 24px; min-width: 0; }
.ds-share-fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.ds-share-fieldset legend { padding: 0; margin-bottom: 10px; }
.ds-share-fieldset input:not([type="checkbox"]), .ds-share-fieldset select { width: 100%; min-width: 0; }
.ds-share-habits { display: grid; max-height: 220px; overflow: auto; margin-bottom: 8px; }
.ds-share-habits .ds-checkbox-copy { overflow-wrap: anywhere; }
.ds-share-dates { display: grid; gap: 12px; }
.ds-share-feedback { color: var(--ds-ink); @apply type-small; }
.ds-share-preview-column { display: grid; gap: 14px; min-width: 0; }
.ds-share-preview { display: grid; place-items: center; padding: 22px; min-height: 240px; background: var(--ds-surface); border: 1px solid var(--ds-rule); }
.ds-share-preview img { display: block; width: 100%; height: auto; box-shadow: 0 3px 14px #0000000d; }
.ds-share-preview > div { display: grid; gap: 16px; }
.ds-share-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.ds-share-actions .ds-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
@media (max-width: 900px) {
  .ds-share-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .ds-share-panel { padding: 20px; }
  .ds-share-preview { padding: 12px; }
}
.ds-task-add-action { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
@media (max-width: 640px) {
  .ds-habit-title-row { gap: 8px; flex-wrap: wrap; }
  .ds-editable-task-row { gap: 4px; }
  .ds-inline-item-form { padding: 16px; }
}
