/* Beispielwoche der Planseite im Look des Training Hub (components/plan_sample_week.html,
   static/js/shop_sample_week.js). Farben der Sportarten und Intensitaetsstufen wie im Hub
   (Aspect_Core/training_calendar/static/training_calendar/coach_calendar.css). Praefix shw-.
   Desktop ab 1000 px: 7 Tagesspalten + Wochenspalte. Darunter wie der Hub am Handy: Wochensumme oben,
   Tage untereinander mit Kuerzel links. */

.shw {
    --shw-bike: #285180;
    --shw-swim: #0f7f8c;
    --shw-run: #6f42c1;
    --shw-strength: #4a5568;
    --shw-key: #c8860d;
    --shw-text: #222831;
    --shw-muted: #6c757d;
    --shw-line: #e0e3e8;
    --shw-card-line: #d0d4db;
    --shw-head: #eef2f7;
    --shw-navy: #153043;
    position: relative;
    color: var(--shw-text);
    background: #fff;
    border: 1px solid var(--shw-card-line);
    border-radius: 12px;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.35;
}

.shw-defs { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.shw-g .shw-st-a { stop-color: var(--a); }
.shw-g .shw-st-b { stop-color: var(--b); }
.shw-g-z0 { --a: #e6eaf0; --b: #cfd6e0; }
.shw-g-z1 { --a: #aab5c6; --b: #7a879c; }
.shw-g-z2 { --a: #6f9df1; --b: #3463cf; }
.shw-g-z3 { --a: #4fc4a5; --b: #148a74; }
.shw-g-z4 { --a: #b6d462; --b: #7aa22e; }
.shw-g-z5 { --a: #f9c962; --b: #e2961a; }
.shw-g-z6 { --a: #f69c62; --b: #d95e24; }
.shw-g-z7 { --a: #ef6d77; --b: #bf2d41; }
.shw-g-s1 { --a: #b5bbc6; --b: #848c9a; }
.shw-g-s2 { --a: #5a83c0; --b: #26487a; }
.shw-g-s3 { --a: #7fc8ca; --b: #3c9294; }
.shw-g-s4 { --a: #edc666; --b: #c68f20; }
.shw-g-s5 { --a: #ed6e6e; --b: #bd3535; }

.shw .shw-z0 { fill: url(#shwG-z0) #cfd6e0; }
.shw .shw-z1 { fill: url(#shwG-z1) #7a879c; }
.shw .shw-z2 { fill: url(#shwG-z2) #3463cf; }
.shw .shw-z3 { fill: url(#shwG-z3) #148a74; }
.shw .shw-z4 { fill: url(#shwG-z4) #7aa22e; }
.shw .shw-z5 { fill: url(#shwG-z5) #e2961a; }
.shw .shw-z6 { fill: url(#shwG-z6) #d95e24; }
.shw .shw-z7 { fill: url(#shwG-z7) #bf2d41; }
.shw .shw-s1 { fill: url(#shwG-s1) #848c9a; }
.shw .shw-s2 { fill: url(#shwG-s2) #26487a; }
.shw .shw-s3 { fill: url(#shwG-s3) #3c9294; }
.shw .shw-s4 { fill: url(#shwG-s4) #c68f20; }
.shw .shw-s5 { fill: url(#shwG-s5) #bd3535; }
.shw-mini rect, .shw-plot rect {
    shape-rendering: geometricPrecision;
    stroke: rgba(255, 255, 255, .8);
    stroke-width: .75px;
    vector-effect: non-scaling-stroke;
}
/* Punkte in der Ablaufliste (gleiche Stufenfarben, ohne Verlauf) */
.shw-dot { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #3463cf; }
.shw-dot.shw-z0 { background: #cfd6e0; } .shw-dot.shw-z1 { background: #7a879c; } .shw-dot.shw-z2 { background: #3463cf; }
.shw-dot.shw-z3 { background: #148a74; } .shw-dot.shw-z4 { background: #7aa22e; } .shw-dot.shw-z5 { background: #e2961a; }
.shw-dot.shw-z6 { background: #d95e24; } .shw-dot.shw-z7 { background: #bf2d41; } .shw-dot.shw-s1 { background: #848c9a; }
.shw-dot.shw-s2 { background: #26487a; } .shw-dot.shw-s3 { background: #3c9294; } .shw-dot.shw-s4 { background: #c68f20; }
.shw-dot.shw-s5 { background: #bd3535; }

/* ---------- Kopf: Spaltennamen + Wochenband ---------- */
.shw-cols { display: none; }
.shw-weekhead {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
    padding: 9px 12px; background: var(--shw-head); border-bottom: 1px solid var(--shw-card-line);
}
.shw-weekhead__no { font-weight: 700; font-size: 14px; }
.shw-weekhead__of { color: var(--shw-muted); }
.shw-chip {
    display: inline-flex; align-items: center; padding: 1px 9px; border: 1px solid #b9c4d3; border-radius: 999px;
    background: #fff; color: var(--shw-navy); font-size: 12px; font-weight: 600;
}

/* ---------- Raster ---------- */
.shw-grid { display: flex; flex-direction: column; }
.shw-day {
    display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px;
    padding: 8px 10px 8px 0; border-bottom: 1px solid var(--shw-line);
}
.shw-day__label { padding: 6px 0 0 12px; text-align: center; color: var(--shw-muted); font-weight: 600; text-transform: uppercase; font-size: 12px; }
.shw-day__long { display: none; }
.shw-day__cards { display: flex; flex-direction: column; gap: 6px; min-height: 28px; }
.shw-day.is-empty .shw-day__cards { min-height: 0; }

/* ---------- Karte (wie .tc-workout im Hub) ---------- */
.shw-card {
    --shw-sport: var(--shw-muted);
    --pad: 7px;
    position: relative;
    padding: 5px 6px 5px var(--pad);
    border: 1px solid var(--shw-card-line);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
    overflow: hidden;
    transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.shw-card[data-sport="bike"] { --shw-sport: var(--shw-bike); }
.shw-card[data-sport="run"] { --shw-sport: var(--shw-run); }
.shw-card[data-sport="swim"] { --shw-sport: var(--shw-swim); }
.shw-card[data-sport="strength"] { --shw-sport: var(--shw-strength); }
.shw-card[role="button"] { cursor: pointer; }
.shw-card[role="button"]:hover { box-shadow: 0 3px 10px rgba(15, 23, 42, .12); border-color: #b0b5bf; transform: translateY(-1px); }
.shw-card:focus-visible, .shw-note:focus-visible { outline: 2px solid var(--shw-bike); outline-offset: 1px; }
.shw-card.is-missing { opacity: .6; }
.shw-card__top { position: relative; min-width: 0; }
.shw-card__ico { position: absolute; left: 0; top: 2px; width: 14px; text-align: center; font-size: .74rem; color: var(--shw-sport); }
.shw-card__title {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    text-indent: 19px; font-weight: 600; font-size: 13px; line-height: 1.3; overflow-wrap: break-word; hyphens: auto;
}
.shw-card__sub { margin-top: 2px; color: var(--shw-muted); font-size: .72rem; }
.shw-card__vals { display: flex; flex-wrap: wrap; align-items: center; gap: 1px 6px; margin-top: 3px; white-space: nowrap; }
.shw-card__dur { font-weight: 700; }
.shw-card__val { color: var(--shw-muted); }
.shw-card__flags { margin-left: auto; display: inline-flex; gap: 5px; color: var(--shw-muted); font-size: .7rem; }
.shw-key { color: var(--shw-key); }
/* Mini-Profil buendig am unteren Rand, von Kante zu Kante */
.shw-mini {
    display: block; width: calc(100% + var(--pad) + 6px); height: 22px;
    margin: 6px -6px -5px calc(-1 * var(--pad));
}

/* ---------- Notizen ---------- */
.shw-note {
    display: flex; flex-direction: column; gap: 2px;
    padding: 6px 8px; border: 1px solid var(--shw-line); border-radius: 6px; background: #f4f6f9;
    color: var(--shw-text); font-size: 12.5px;
}
.shw-note[role="button"] { cursor: pointer; }
.shw-note[role="button"]:hover { border-color: #b0b5bf; }
.shw-note__title { display: flex; align-items: baseline; gap: 6px; font-weight: 600; }
.shw-note__title i { color: var(--shw-muted); font-size: .78rem; }
.shw-note__sub { color: var(--shw-muted); font-size: 12px; }
.shw-note__kicker { display: flex; gap: 5px; align-items: center; color: #6b3fa0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.shw-note__body {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    color: var(--shw-muted); font-size: 12px;
}
.shw-note.is-rest { background: #f1f3f5; }

/* ---------- Wochensumme ---------- */
.shw-sum { order: -1; padding: 8px 12px 10px; border-bottom: 1px solid var(--shw-card-line); background: #fff; }
.shw-sum__table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.shw-sum__table th, .shw-sum__table td { padding: 2px 0; text-align: right; font-weight: 400; }
.shw-sum__table th[scope="row"], .shw-sum__table thead th:first-child { text-align: left; }
.shw-sum__table thead th { color: var(--shw-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--shw-line); }
.shw-sum__table tbody th { font-weight: 600; }
.shw-sum__table tfoot th, .shw-sum__table tfoot td { padding-top: 4px; border-top: 1px solid var(--shw-line); font-weight: 700; }
.shw-sum__table td { padding-left: 8px; }
.shw-sum__count { margin: 6px 0 0 !important; color: var(--shw-muted); font-size: 12px; }

/* ---------- Desktop: Spalten wie im Hub ---------- */
@media (min-width: 1000px) {
    .shw-cols {
        display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) 168px;
        border-bottom: 1px solid var(--shw-card-line);
    }
    .shw-cols span {
        padding: 8px 8px; color: var(--shw-muted); font-size: 11px; font-weight: 600; letter-spacing: .06em;
        text-transform: uppercase; border-left: 1px solid var(--shw-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .shw-cols span:first-child { border-left: 0; }
    .shw-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) 168px; min-height: 220px; }
    .shw-day {
        display: block; padding: 6px 6px 10px; border-bottom: 0; border-left: 1px solid var(--shw-line);
    }
    .shw-day:first-child { border-left: 0; }
    .shw-day__label { display: none; }            /* Tagesnamen stehen in .shw-cols */
    .shw-sum { order: 0; padding: 6px 8px; border-bottom: 0; border-left: 1px solid var(--shw-line); background: #fafbfc; }
    .shw-sum__table { font-size: 12px; }
}

/* ---------- Dialog (wie die Detailansicht im Hub) ---------- */
.shw-dialog {
    width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 48px); padding: 0;
    border: 0; border-radius: 14px; box-shadow: 0 24px 60px rgba(15, 23, 42, .35); color: var(--shw-text);
    overflow: hidden;
}
.shw-dialog[open] { display: flex; flex-direction: column; }
.shw-dialog::backdrop { background: rgba(15, 23, 42, .55); }
.shw-dialog__head {
    display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 14px;
    background: var(--shw-navy); color: #fff; border-bottom: 3px solid var(--shw-dialog-sport, #3463cf);
}
.shw-dialog__ico {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; font-size: 1.05rem;
}
.shw-dialog__heading { min-width: 0; flex: 1 1 auto; }
.shw-dialog__kicker { color: #c8d8f0; font-size: 12.5px; }
.shw-dialog__kicker b { color: #9fc0f5; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.shop-app .shw-dialog__title { margin: 2px 0 0; color: #fff; font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.shw-dialog__badge {
    display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; padding: 2px 10px; border-radius: 999px;
    background: rgba(200, 134, 13, .2); color: #f5c060; font-size: 12px; font-weight: 600;
}
.shw-dialog__badge[hidden] { display: none; }
.shw-dialog__close {
    flex: 0 0 auto; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1);
    color: #fff; font-size: 1.05rem; cursor: pointer;
}
.shw-dialog__close:hover, .shw-dialog__close:focus-visible { background: rgba(255, 255, 255, .22); }
.shw-dialog__body { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px 18px; font-size: 14px; line-height: 1.5; }
.shw-dialog__foot { display: flex; justify-content: flex-end; padding: 10px 18px; border-top: 1px solid var(--shw-line); background: #fafbfc; }
.shop-app .shw-dialog p { margin: 0 0 .75rem; }

.shw-callout { display: flex; gap: 10px; margin-bottom: 14px; padding: 10px 12px; border-radius: 8px; background: #fff7e6; border: 1px solid #f3dfb3; }
.shw-callout i { margin-top: 3px; color: #c8860d; }
.shw-metrics { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.shw-metric { display: inline-flex; gap: 6px; align-items: baseline; padding: 3px 10px; border: 1px solid var(--shw-line); border-radius: 999px; font-size: 13px; font-weight: 600; }
.shw-metric span { color: var(--shw-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.shw-plot { display: block; width: 100%; height: 96px; margin: 0 0 14px; }
.shw-heading { margin: 14px 0 6px; color: var(--shw-muted); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.shw-rows { border: 1px solid var(--shw-line); border-radius: 10px; overflow: hidden; }
.shw-row { padding: 9px 12px; border-top: 1px solid var(--shw-line); }
.shw-row:first-child { border-top: 0; }
.shw-row__head { display: flex; gap: 10px; }
.shw-row__no { flex: 0 0 auto; min-width: 16px; color: var(--shw-muted); }
.shw-row__title { display: flex; align-items: center; font-weight: 600; }
.shw-row__summary { color: var(--shw-text); }
.shw-row__field, .shw-row__note, .shw-row__segs { margin-left: 26px; color: var(--shw-muted); font-size: 13px; }
.shw-row__field b { margin-right: 6px; color: var(--shw-text); font-weight: 600; }
.shw-row__note { font-style: italic; }
.shw-row__segs { margin-top: 4px; padding-left: 8px; border-left: 2px solid var(--shw-line); }
.shw-row__seg { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 6px; }
.shw-row__seg .shw-dot { align-self: center; }
.shw-rpe { list-style: none; margin: 0; padding: 0; border: 1px solid var(--shw-line); border-radius: 10px; overflow: hidden; }
.shw-rpe li { display: flex; gap: 10px; padding: 4px 12px; border-top: 1px solid var(--shw-line); font-size: 13px; }
.shw-rpe li:first-child { border-top: 0; }
.shw-rpe li.is-used { background: #eef4ff; font-weight: 600; }
.shw-rpe__value { min-width: 22px; font-variant-numeric: tabular-nums; font-weight: 700; }
.shw-rpe__label.is-between { color: var(--shw-muted); }
.shw-text { white-space: pre-line; }
.shw a { overflow-wrap: anywhere; }

@media (max-width: 600px) {
    .shw-dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
    .shw-dialog__head { padding: 14px 14px 12px; }
    .shw-dialog__body { padding: 14px; }
    .shw-row__field, .shw-row__note, .shw-row__segs { margin-left: 0; }
}
