:root {
    --stretch-ink: #1e293b;
    --stretch-muted: #64748b;
    --stretch-primary: #757575;
    --stretch-dark: #4338ca;
    --stretch-accent: #757575;
    --stretch-paper: #FFFFFF;
    --stretch-line: #e2e8f0;
    --stretch-shadow: 0 14px 32px rgba(99, 102, 241, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: #f8fafc;
    color: var(--stretch-ink);
    font-family: Segoe UI, Tahoma, sans-serif;
}

.stretchPage {
    max-width: 1240px;
    margin: 70px auto 0;
    padding: 30px 24px 60px;
}

.stretchHero {
    position: relative;
    overflow: hidden;
    margin-bottom: 22px;
    padding: 30px clamp(18px, 4vw, 48px);
    background: #FFFFFF;
    border: 1px solid var(--stretch-line);
    border-top: 4px solid var(--stretch-primary);
    border-radius: 3px;
    box-shadow: var(--stretch-shadow);
}

.stretchEyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 12px;
    color: var(--stretch-accent);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.stretchHero h1 {
    margin: 0 0 8px;
    color: var(--stretch-ink);
    font-size: clamp(1.5rem, 3vw, 2.35rem);
    letter-spacing: .04em;
    font-weight: 800;
}

.stretchHero p {
    max-width: 780px;
    margin: 0;
    color: var(--stretch-muted);
    line-height: 1.55;
}

.stretchLayout {
    display: grid;
    grid-template-columns: minmax(280px, .78fr) minmax(0, 1.22fr);
    gap: 20px;
    align-items: start;
}

.stretchPanel {
    padding: 22px;
    background: var(--stretch-paper);
    border: 1px solid var(--stretch-line);
    border-radius: 3px;
    box-shadow: var(--stretch-shadow);
}

.stretchPanel h2 {
    margin: 0 0 18px;
    color: var(--stretch-ink);
    font-size: 1.05rem;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.stretchPanel h2 i {
    margin-right: 7px;
    color: var(--stretch-accent);
    font-size: .9em;
}

.savedSessionsHeading { margin-top: 24px !important; }

.planForm { display: grid; gap: 12px; }

.field {
    display: flex;
    flex-direction: column;
    color: var(--stretch-muted);
    font-size: .84rem;
    font-weight: 600;
}

.field input, .field textarea {
    width: 100%;
    min-height: 43px;
    margin-top: 6px;
    padding: 0 11px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #fff;
    color: var(--stretch-ink);
    font: inherit;
}

.field input:focus, .field textarea:focus {
    border-color: var(--stretch-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .14);
    outline: none;
}

.roundGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.formActions, .timerActions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stretchButton {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--stretch-primary);
    border-radius: 3px;
    background: var(--stretch-primary);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    font-size: .8rem;
    letter-spacing: .04em;
}

.stretchButton.secondary {
    background: #fff;
    color: var(--stretch-ink);
    border-color: var(--stretch-line);
}

.stretchButton:hover {
    box-shadow: 0 8px 16px rgba(99, 102, 241, .16);
    transform: translateY(-1px);
}

.stretchStatus {
    min-height: 20px;
    color: #b91c1c;
    font-size: .84rem;
}

.stretchList { display: grid; gap: 10px; }

.stretchItem {
    display: grid;
    grid-template-columns: 38px 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--stretch-line);
    border-radius: 3px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, .05);
}

.orderControls { display: grid; gap: 5px; }

.iconButton {
    width: 30px;
    height: 30px;
    border: 1px solid var(--stretch-line);
    border-radius: 2px;
    background: #eef2ff;
    color: var(--stretch-primary);
    cursor: pointer;
}

.iconButton:disabled { opacity: .35; cursor: not-allowed; }

.stretchItem h3 {
    margin: 0;
    color: var(--stretch-ink);
    font-size: 1rem;
}

.itemMeta {
    margin-top: 5px;
    color: var(--stretch-muted);
    font-size: .8rem;
    line-height: 1.45;
}

.itemActions { display: flex; gap: 5px; }
.planEmpty { padding: 18px; color: var(--stretch-muted); font-size: .88rem; line-height: 1.5; }

.transitionRestField {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 6px 9px;
    border: 1px solid var(--stretch-line);
    border-radius: 3px;
    background: #f8fafc;
    color: var(--stretch-ink);
    font-size: .76rem;
    font-weight: 700;
}

.transitionRestField::before {
    color: var(--stretch-accent);
    content: "Rest";
    font-size: .92rem;
}

.transitionRestInput {
    width: 58px;
    min-height: 30px;
    padding: 0 8px;
    border: 1px solid #94a3b8;
    border-radius: 2px;
    background: #fff;
    color: var(--stretch-ink);
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.transitionRestInput:focus {
    border-color: var(--stretch-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .14);
    outline: none;
}

.timerPanel { margin-top: 20px; }

.timerDisplay {
    padding: 24px;
    text-align: center;
    border: 1px solid #c7d2fe;
    border-radius: 3px;
    background: #e0e7ff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8);
}

.timerPhase {
    color: var(--stretch-accent);
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.timerName {
    margin: 8px 0;
    color: var(--stretch-ink);
    font-size: 1.35rem;
    font-weight: 700;
}

.timerClock {
    font-variant-numeric: tabular-nums;
    color: var(--stretch-ink);
    font-size: clamp(2.8rem, 7vw, 5.2rem);
    font-weight: 800;
    line-height: 1;
}

.timerProgress {
    height: 7px;
    margin: 18px auto 0;
    max-width: 500px;
    overflow: hidden;
    border-radius: 99px;
    background: #cbd5e1;
}

.timerProgress span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--stretch-primary);
    transition: width 300ms linear;
}

.timerNext { margin-top: 12px; color: var(--stretch-muted); font-size: .84rem; }
.timerMessage { min-height: 21px; margin-top: 12px; color: var(--stretch-muted); font-size: .82rem; }
.timerActions { justify-content: center; margin-top: 18px; }

.savedPlanList { display: grid; gap: 8px; }

.savedPlan {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-left: 3px solid var(--stretch-primary);
    border-radius: 0 3px 3px 0;
    background: #fff;
}

.savedPlan strong { color: var(--stretch-ink); font-size: .86rem; }
.savedPlan small { display: block; margin-top: 3px; color: var(--stretch-muted); font-size: .73rem; }

.stretchCalendarPanel {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    width: min(100%, 430px);
    padding: 16px;
}

.calendarTools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.calendarMonth {
    color: var(--stretch-primary);
    font-size: .8rem;
    font-weight: 600;
}

.calendarNavigation { display: flex; gap: 6px; }

.calendarNavigation button {
    width: 30px;
    min-height: 30px;
    padding: 0;
    border: 1px solid var(--stretch-line);
    border-radius: 2px;
    background: #fff;
    color: var(--stretch-primary);
    cursor: pointer;
}

.calendarNavigation button:hover { background: #eef2ff; }

.calendarWeekdays, .stretchCalendarGrid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.calendarWeekdays {
    margin-bottom: 8px;
    color: var(--stretch-muted);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-align: center;
    text-transform: uppercase;
}

.stretchCalendarDay {
    position: relative;
    min-height: 40px;
    padding: 6px;
    border: 1px solid var(--stretch-line);
    border-radius: 2px;
    background: #fff;
    color: var(--stretch-ink);
}

.stretchCalendarDayEmpty { border-color: transparent; background: transparent; }
.stretchCalendarDate { display: block; font-size: .8rem; font-weight: 700; }

.stretchCalendarDayToday {
    border-color: var(--stretch-accent);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, .2);
}

.stretchCalendarDayComplete {
    border-color: #a5b4fc;
    background: #eef2ff;
    color: var(--stretch-ink);
}

.stretchCalendarIcon {
    position: absolute;
    right: 7px;
    bottom: 7px;
    color: var(--stretch-accent);
    font-size: .85rem;
}

.calendarLegend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    color: var(--stretch-muted);
    font-size: .78rem;
}

.calendarLegend i { color: var(--stretch-accent); }

.calendarFooter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.calendarFooter .calendarLegend { margin-top: 0; }

.resetCalendarButton {
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid #fecaca;
    border-radius: 2px;
    background: #fef2f2;
    color: #b91c1c;
    cursor: pointer;
    font: inherit;
    font-size: .74rem;
    font-weight: 700;
}

.resetCalendarButton:hover { background: #fee2e2; border-color: #fca5a5; }

.hidden { display: none !important; }

@media(max-width:900px) {
    .stretchLayout { grid-template-columns: 1fr; }
    .stretchCalendarPanel {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
        padding: 16px;
    }
}

@media(max-width:600px) {
    .stretchPage { padding: 22px 14px 42px; }
    .roundGrid { grid-template-columns: 1fr; }
    .stretchItem { grid-template-columns: 34px 1fr; }
    .itemActions { grid-column: 2; }
    .timerDisplay { padding: 20px 12px; }
    .calendarTools, .calendarFooter { align-items: flex-start; flex-direction: column; }
    .calendarWeekdays, .stretchCalendarGrid { gap: 4px; }
    .stretchCalendarDay { min-height: 52px; padding: 6px; }
    .stretchCalendarIcon { right: 6px; bottom: 6px; font-size: .72rem; }
}