/* adaptive-run — dashboard. Mobile-first, světlý i tmavý režim. */

:root {
    --bg:        #f6f7f9;
    --card:      #ffffff;
    --line:      #e3e6ea;
    --text:      #16191d;
    --muted:     #6b7280;
    --accent:    #1f6feb;

    --green:     #1a7f4b;
    --green-bg:  #e6f4ec;
    --amber:     #9a6700;
    --amber-bg:  #fff4e0;
    --red:       #b42318;
    --red-bg:    #fdeceb;

    /* série grafů */
    --c1: #1f6feb;   /* CTL / fitness */
    --c2: #e0713a;   /* ATL / fatigue */
    --c3: #1a7f4b;   /* HRV */
    --c4: #8b93a1;   /* ostatní */
    --c5: #7a5af8;   /* kolo */
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:       #101317;
        --card:     #181c22;
        --line:     #2a313a;
        --text:     #e6e9ee;
        --muted:    #9aa4b2;
        --accent:   #4d9bff;

        --green:    #4ec98a;
        --green-bg: #12291e;
        --amber:    #e0b341;
        --amber-bg: #2b2312;
        --red:      #f2857c;
        --red-bg:   #2c1715;

        --c1: #4d9bff;
        --c2: #f0894f;
        --c3: #4ec98a;
        --c4: #7c8697;
        --c5: #9b7cff;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 16px 14px 48px; }

/* --- hlavička --- */
header.top {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
header.top h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
header.top .sub { color: var(--muted); font-size: 13px; }
header.top a { color: var(--muted); font-size: 13px; text-decoration: none; }
header.top a:hover { color: var(--accent); text-decoration: underline; }

/* --- karty --- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.card > h2 {
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--muted); margin: 0 0 12px; font-weight: 600;
}

/* --- čísla --- */
.stats { display: flex; flex-wrap: wrap; gap: 20px 28px; }
.stat .val { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .note { font-size: 11px; color: var(--muted); }

/* --- stav připravenosti --- */
.badge {
    display: inline-block; padding: 3px 9px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red   { background: var(--red-bg);   color: var(--red); }
.badge.off   { background: var(--bg);       color: var(--muted); border: 1px solid var(--line); }

/* --- tabulky --- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- grafy --- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

/* --- zdraví dat --- */
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.health .item { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.health .item .k { font-size: 11px; color: var(--muted); }
.health .item .v { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.health .item.bad  { border-color: var(--red);   }
.health .item.warn { border-color: var(--amber); }

.months { display: flex; gap: 3px; align-items: flex-end; height: 54px; margin-top: 4px; }
.months .m { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.months .m .bar { background: var(--c1); border-radius: 2px 2px 0 0; min-height: 1px; }
.months .m .bar.zero { background: var(--red); height: 2px; }
.months .lb { font-size: 9px; color: var(--muted); text-align: center; margin-top: 3px; }

/* --- poznámky --- */
.muted { color: var(--muted); font-size: 13px; }
.warnbox {
    border-left: 3px solid var(--amber); background: var(--amber-bg);
    color: var(--text); padding: 10px 12px; border-radius: 0 6px 6px 0;
    font-size: 13px; margin-bottom: 14px;
}
.warnbox strong { color: var(--amber); }
.phase {
    display: inline-block; font-size: 11px; color: var(--muted);
    border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px;
}

/* --- login --- */
.login { max-width: 340px; margin: 12vh auto; padding: 0 16px; }
.login h1 { font-size: 19px; margin: 0 0 4px; }
.login p.sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 4px; }
input[type=text], input[type=password] {
    width: 100%; padding: 9px 11px; margin-bottom: 14px;
    border: 1px solid var(--line); border-radius: 7px;
    background: var(--card); color: var(--text); font-size: 15px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
button {
    width: 100%; padding: 10px; border: 0; border-radius: 7px;
    background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
button:hover { filter: brightness(1.08); }
.err {
    background: var(--red-bg); color: var(--red); border-radius: 7px;
    padding: 9px 11px; font-size: 13px; margin-bottom: 14px;
}

@media (min-width: 620px) {
    .wrap { padding-top: 26px; }
    header.top h1 { font-size: 22px; }
}
