.week-demo { scroll-margin-top: 14px; }
.demo-caption { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 9px; color: var(--muted); font-size: .875rem; }
.demo-caption span { margin-inline: 3px; }
.demo-reset { border: 0; background: transparent; color: var(--muted); padding: 5px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.demo-reset:hover { color: var(--deep); }
.week-demo[data-demo-theme="light"] { color-scheme: light; }
.week-demo[data-demo-theme="dark"] { color-scheme: dark; }
.week-demo {
    --d-bg: light-dark(#f7f7f5, #1f1e1d);
    --d-surface: light-dark(#fff, #2a2927);
    --d-sidebar: light-dark(#efefec, #33322f);
    --d-line: light-dark(#e2e1dc, #3d3c38);
    --d-text: light-dark(#1f1f1e, #ecebe8);
    --d-muted: light-dark(#666560, #b4b2aa);
    --d-accent: #16c1d8;
    --d-link: light-dark(#08707f, #4fd6e8);
    --d-soft: light-dark(#d6f4f8, #1c3f45);
    --d-today: light-dark(#eaf6f6, #20292a);
    --d-shadow: 0 12px 48px light-dark(#1f1f1e15, #0005);
}
.demo-window {
    display: grid; grid-template-columns: 145px minmax(0, 1fr); min-height: 422px;
    border: 1px solid var(--d-line); border-radius: 17px; overflow: hidden;
    color: var(--d-text); background: var(--d-bg); box-shadow: var(--d-shadow);
    font-size: .875rem; line-height: 1.4;
}
.demo-nav { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 13px 9px; border-right: 1px solid var(--d-line); background: var(--d-sidebar); }
.demo-brand { padding: 1px 8px 4px; font-size: 1.18rem; }
.demo-nav-menu { display: grid; gap: 3px; }
.demo-nav button { border: 0; border-radius: 6px; padding: 8px; background: transparent; color: var(--d-muted); text-align: left; cursor: pointer; }
.demo-nav button:hover, .demo-nav button[aria-pressed="true"] { color: var(--d-text); background: var(--d-surface); }
.demo-nav button[aria-pressed="true"] { font-weight: 650; }
.demo-nav .demo-theme { margin-top: auto; }
.demo-xp { display: grid; gap: 4px; padding: 8px 3px 0; border-top: 1px solid var(--d-line); font-size: .75rem; }
.demo-xp > div { display: flex; justify-content: space-between; gap: 4px; }
.demo-xp span, .demo-muted { color: var(--d-muted); }
.demo-xp progress { width: 100%; height: 7px; accent-color: var(--d-accent); }
.demo-main { min-width: 0; }
.demo-panel { padding: 14px; }
.demo-panel h2 { font-size: clamp(1.12rem, 2vw, 1.42rem); letter-spacing: -.015em; line-height: 1.15; }
.demo-toolbar, .demo-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.demo-toolbar .demo-tools { margin-inline-start: auto; }
.demo-toolbar [data-week-range] { margin-inline: 4px; }
.demo-push { margin-inline-start: auto; }
.demo-btn, .demo-icon-btn {
    font: inherit; min-height: 34px; padding: 5px 10px; border: 1px solid var(--d-line);
    border-radius: 6px; color: var(--d-text); background: var(--d-surface); cursor: pointer;
}
.demo-icon-btn { width: 34px; padding: 0; font-size: 1.24rem; }
.demo-btn:hover:not(:disabled), .demo-icon-btn:hover:not(:disabled) { border-color: var(--d-link); }
.demo-btn:disabled, .demo-icon-btn:disabled { opacity: .55; cursor: default; }
.demo-primary { border-color: var(--d-accent); background: var(--d-accent); color: #06262b; font-weight: 650; }
.week-demo :is(button, input, select, summary, h2):focus-visible { outline: 2px solid var(--d-link); outline-offset: 1px; }
.demo-columns { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin-block: 13px; }
.demo-column { min-width: 0; min-height: 258px; padding: 6px 5px; border-left: 1px solid var(--d-line); }
.demo-column:first-child { border-left: 0; }
.demo-column.today { background: var(--d-today); border-radius: 8px; border-left-color: transparent; }
.demo-column.today + .demo-column { border-left-color: transparent; }
.demo-column.drop-target { background: var(--d-soft); }
.demo-column h3 { padding: 2px 4px; color: var(--d-muted); font-size: .82rem; }
.demo-column.today h3 { color: var(--d-link); }
.demo-add-task, .demo-add-row { color: var(--d-muted); background: transparent; cursor: pointer; }
.demo-add-task { margin: 3px 0; padding: 5px 4px; border: 0; border-radius: 5px; }
.demo-add-task:hover { color: var(--d-link); background: var(--d-surface); }
.demo-task-list { display: grid; align-content: start; gap: 6px; }
.demo-task {
    --project: var(--d-line); position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr);
    gap: 5px; padding: 7px 18px 7px 6px; border: 1px solid var(--d-line); border-left: 4px solid var(--project);
    border-radius: 7px; background: var(--d-surface); cursor: grab;
}
.demo-task.blue { --project: light-dark(#2b69d0, #75aaff); }
.demo-task.pink { --project: light-dark(#a82977, #ed87c3); }
.demo-task.teal { --project: light-dark(#08707f, #44c2d5); }
.demo-task.important {
    border-top-color: light-dark(#ad8400, #b39432); border-right-color: light-dark(#ad8400, #b39432);
    border-bottom-color: light-dark(#ad8400, #b39432); background: light-dark(#fff8df, #2e2c25);
}
.demo-task:hover { box-shadow: 0 1px 5px #0002; }
.demo-task-project { display: block; color: var(--project); font-size: .76rem; font-weight: 650; }
.demo-task-title, .demo-task-menu { font: inherit; color: var(--d-text); border: 0; background: transparent; padding: 0; cursor: pointer; }
.demo-task-title { max-width: 100%; text-align: left; overflow-wrap: anywhere; }
.demo-task-menu { position: absolute; right: 2px; top: 4px; width: 18px; min-height: 24px; border-radius: 5px; font-weight: 700; }
.demo-task-menu:hover { background: var(--d-sidebar); }
.demo-task.done .demo-task-title, .demo-subtask input:checked + span { color: var(--d-muted); text-decoration: line-through; }
.demo-check, .demo-mark {
    display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--d-muted);
    background: var(--d-surface); border-radius: 4px; color: var(--d-link); cursor: pointer; font-weight: 700;
}
.demo-check { width: 16px; height: 16px; font-size: .75rem; line-height: 1; margin-top: 2px; }
.demo-check[aria-pressed="true"], .demo-mark[aria-pressed="true"] { background: var(--d-accent); border-color: var(--d-accent); color: #06262b; }
.demo-check[aria-pressed="true"]::after, .demo-mark[aria-pressed="true"]::after { content: '✓'; }
.demo-task details { margin-top: 4px; color: var(--d-muted); line-height: 1.28; font-size: .76rem; }
.demo-task summary { cursor: pointer; }
.demo-task summary span { white-space: nowrap; }
.demo-subtask { display: flex; align-items: flex-start; gap: 3px; margin-top: 5px; overflow-wrap: anywhere; }
.demo-subtask input { flex: none; margin: 2px 0 0; accent-color: var(--d-accent); }
.demo-column.someday { min-height: 0; border: 1px dashed var(--d-line); border-radius: 8px; padding: 8px; }
.demo-column.someday .demo-task-list { grid-template-columns: repeat(auto-fill, minmax(min(155px, 100%), 1fr)); }
.demo-inline-form, .demo-run-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; margin-block: 14px; }
.week-demo :is(input:not([type="checkbox"]), select) {
    min-width: 0; max-width: 100%; min-height: 34px; padding: 5px 7px; font: inherit; border: 1px solid var(--d-line);
    border-radius: 6px; background: var(--d-surface); color: var(--d-text);
}
.demo-inline-form input { flex: 1 1 210px; max-width: 310px; }
.demo-habits { width: 100%; border-spacing: 0; border: 1px solid var(--d-line); border-radius: 9px; overflow: hidden; background: var(--d-surface); }
.demo-habits :is(th, td) { padding: 7px 4px; border-bottom: 1px solid var(--d-line); text-align: center; }
.demo-habits .today { background: var(--d-soft); }
.demo-habits :is(thead, .demo-streak) { color: var(--d-muted); font-size: .82rem; }
.demo-habits thead small { display: block; font-size: .75rem; }
.demo-habits :is(th:first-child, th[scope="row"]) { padding-left: 9px; text-align: left; }
.demo-habits tbody tr:last-child > * { border-bottom: 0; }
.demo-habit-title { display: flex; align-items: center; gap: 7px; overflow-wrap: anywhere; }
.demo-habit-title > span { width: 29px; height: 29px; flex: 0 0 29px; display: grid; place-items: center; border-radius: 7px; background: var(--d-soft); color: var(--d-link); }
.demo-mark { width: 30px; height: 30px; border-color: var(--d-line); font-size: .95rem; }
.demo-mark:disabled { opacity: .38; cursor: default; }
.demo-mobile-day { display: none; }
.demo-sports { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 12px; margin-top: 14px; }
.demo-sport-card {
    display: grid; justify-items: start; align-content: start; gap: 4px; min-height: 152px; padding: 14px;
    text-align: left; color: var(--d-text); background: var(--d-surface); border: 1px solid var(--d-line); border-radius: 10px; cursor: pointer;
}
.demo-sport-card:hover, button.demo-workout-item:hover { border-color: var(--d-link); }
.demo-sport-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; margin-bottom: 5px; background: var(--d-soft); color: var(--d-link); }
.demo-sport-card > span:last-child { color: var(--d-link); font-size: .82rem; }
.demo-workout-list, .demo-session { display: grid; gap: 8px; max-width: 760px; margin-top: 14px; }
.demo-workout-item { display: grid; grid-template-columns: minmax(100px, .7fr) 1fr auto; gap: 8px; align-items: center; padding: 9px; border: 1px solid var(--d-line); border-radius: 8px; color: var(--d-text); background: var(--d-surface); text-align: left; }
button.demo-workout-item { cursor: pointer; }
.demo-workout-item span { color: var(--d-muted); }
.demo-exercise { min-width: 0; padding: 9px; border: 1px solid var(--d-line); border-radius: 9px; background: var(--d-surface); }
.demo-exercise h3 { color: var(--d-link); font-size: .96rem; }
.demo-sets { width: 100%; margin-top: 6px; border-collapse: collapse; table-layout: fixed; text-align: center; }
.demo-sets th { color: var(--d-muted); font-weight: 650; font-size: .82rem; }
.demo-sets :is(th, td) { padding: 4px 2px; border-bottom: 1px solid var(--d-line); }
.demo-sets :is(th, td):first-child { width: 12%; }
.demo-sets :is(th, td):last-child:not(:nth-child(4)) { width: 13%; }
.demo-set-form { display: grid; grid-template-columns: 12% 25% 25% 25% 13%; align-items: center; padding-top: 6px; text-align: center; }
.demo-set-form input { width: calc(100% - 6px); justify-self: center; }
.demo-sets .demo-check, .demo-set-form .demo-check { width: 29px; height: 29px; margin: 0; justify-self: center; }
.demo-add-row { min-height: 36px; border: 1px dashed var(--d-line); border-radius: 7px; }
.demo-add-row:hover { border-color: var(--d-link); color: var(--d-link); }
.demo-exercise-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(165px, 100%), 1fr)); gap: 6px; }
.demo-exercise-options button { text-align: left; }
.demo-exercise-options span { display: block; }
.demo-run-form label { display: grid; gap: 4px; flex: 0 1 130px; }
.demo-run-records { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.demo-run-records > div { display: grid; gap: 3px; min-width: 112px; padding: 7px 10px; border: 1px solid var(--d-line); border-radius: 8px; background: var(--d-surface); }
.demo-run-records span { color: var(--d-muted); font-size: .82rem; }
.demo-dialog { width: min(calc(100% - 32px), 410px); padding: 18px; border: 1px solid var(--d-line); border-radius: 12px; color: var(--d-text); background: var(--d-bg); }
.demo-dialog::backdrop { background: #0008; }
.demo-dialog form { display: grid; gap: 7px; }
.demo-dialog .demo-tools { justify-content: flex-end; margin-top: 8px; }
.demo-announcement { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 1050px) {
    .demo-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 10px; }
    .demo-column { min-height: 140px; }
}
@media (max-width: 740px) {
    .demo-window { grid-template-columns: minmax(0, 1fr); }
    .demo-nav { flex-flow: row wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--d-line); padding: 7px 8px; gap: 5px; }
    .demo-brand { padding: 0 5px; }
    .demo-nav-menu { display: flex; flex-wrap: wrap; gap: 2px; }
    .demo-nav .demo-theme { margin: 0 0 0 auto; }
    .demo-xp { width: 100%; grid-template-columns: auto minmax(25px, 1fr); align-items: center; gap: 7px; padding: 6px 4px 0; }
    .demo-xp > div { gap: 6px; }
    .demo-xp > span { display: none; }
    .demo-panel { padding: 10px; }
    .demo-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .demo-task { padding-right: 5px; }
    .demo-task-menu { position: static; grid-column: 2; justify-self: end; width: 36px; min-height: 33px; }
}
@media (max-width: 500px) {
    .demo-nav .demo-brand { display: none; }
    .demo-nav button { padding-inline: 6px; }
    .demo-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 7px; }
    .demo-column { min-height: 97px; }
    .demo-column h3 { font-size: .85rem; }
    .demo-task { grid-template-columns: 25px minmax(0, 1fr); }
    .demo-task .demo-check { width: 23px; height: 23px; }
    .demo-habits { display: block; }
    .demo-habits thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .demo-habits tbody { display: grid; }
    .demo-habits tbody tr { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--d-line); padding: 6px; }
    .demo-habits tbody tr:last-child { border-bottom: 0; }
    .demo-habits tbody :is(th, td) { border: 0; padding: 3px 0; }
    .demo-habits tbody th { grid-column: 1 / -1; padding-left: 0; }
    .demo-habits .today { border-radius: 5px; }
    .demo-mobile-day { display: block; color: var(--d-muted); font-size: .75rem; }
    .demo-streak { grid-column: span 3; text-align: left !important; }
    .demo-streak .demo-mobile-day { display: inline; }
    .demo-sports { gap: 7px; }
    .demo-sport-card { padding: 8px; }
    .demo-workout-item { grid-template-columns: minmax(0, 1fr) auto; }
    .demo-workout-item span:first-of-type { grid-column: 1; grid-row: 2; }
    .demo-workout-item span:last-of-type { grid-column: 2; grid-row: 2; }
    .demo-sets th { font-size: .75rem; }
    .demo-run-form label { flex-basis: min(120px, 48%); }
}
@media (pointer: coarse) {
    .demo-nav button, .demo-btn, .demo-icon-btn, .demo-task-menu { min-height: 40px; }
}
