@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=Nunito:wght@400;600;700;800&display=swap');

/* ═══ RESET & VARIABLEN ═════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

:root {
    --primary:    #7c5cbf;
    --primary-d:  #3d2b6b;
    --primary-l:  #ede8f8;
    --primary-b:  #c8b8f0;
    --card:       #ffffff;
    --bg:         #f5f3fa;
    --border:     #e0d8f0;
    --text:       #2d1f52;
    --muted:      #8878aa;
    --divider:    #f0eaf8;
    --radius:     12px;
    --shadow:     0 2px 12px rgba(61,43,107,.08);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
}
button { font-family: inherit; }
a { color: var(--primary); }

/* ═══ APP WRAPPER ═══════════════════════════════════════════════════════════ */
#app {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ═══ HEADER ════════════════════════════════════════════════════════════════ */
header {
    width: 100%;
    background: linear-gradient(135deg, #3d2b6b 0%, #6a4db8 100%);
    padding: 1.4rem 2rem 1.1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
header::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255,255,255,.06) 0%, transparent 60%),
                radial-gradient(circle at 80% 20%, rgba(255,255,255,.09) 0%, transparent 50%);
    pointer-events: none;
}
.header-inner { position: relative; }
.header-icon { font-size: 1.8rem; margin-bottom: .2rem; }
header h1 {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-weight: 800;
    letter-spacing: .15em;
    color: #f0eaff;
    margin-bottom: .15rem;
}
header p { color: rgba(220,210,255,.65); font-size: .7rem; letter-spacing: .12em; }

/* ═══ BADGES ════════════════════════════════════════════════════════════════ */
.badges {
    display: flex;
    gap: .5rem;
    padding: .8rem 1.5rem .4rem;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}
.badge {
    flex: 1;
    background: var(--card);
    border-radius: var(--radius);
    padding: .5rem .4rem;
    border: 1px solid var(--border);
    cursor: pointer;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform .15s;
    min-width: 0;
}
.badge:hover { transform: translateY(-2px); }
.badge-icon  { font-size: 1.1rem; }
.badge-label { font-size: .55rem; color: var(--muted); letter-spacing: .03em; display: block; }
.badge-count { font-size: .7rem; font-weight: 700; display: block; }
.badge-bar   { height: 3px; border-radius: 2px; overflow: hidden; margin-top: 3px; background: var(--border); }
.badge-bar-inner { height: 100%; border-radius: 2px; transition: width .4s; }

/* ═══ OVERDUE BOX ═══════════════════════════════════════════════════════════ */
.overdue-box {
    max-width: 960px;
    margin: .4rem auto;
    background: #f8eee8; border: 1px solid #e0b8a0; border-radius: var(--radius); padding: .6rem .9rem;
}
.overdue-title { color: #9a4a3a; font-size: .72rem; font-weight: 700; margin-bottom: .3rem; }
.overdue-item  { display: flex; align-items: center; gap: .5rem; padding: .28rem 0; border-bottom: 1px solid #e0b8a0; }
.overdue-item:last-child { border-bottom: none; }
.overdue-text  { flex: 1; font-size: .82rem; }
.overdue-text.done { text-decoration: line-through; color: #bbb; }
.overdue-remove { background: none; border: none; color: #ccc; cursor: pointer; font-size: .85rem; padding: 0 .2rem; }

/* ═══ TABS ══════════════════════════════════════════════════════════════════ */
.tabs {
    width: 100%;
    display: flex;
    background: var(--card);
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(61,43,107,.06);
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
    flex: 0 0 auto;          /* nicht strecken – natürliche Breite */
    min-width: 64px;
    padding: .85rem .6rem;   /* mehr Höhe */
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--muted);
    font-size: .62rem;
    font-weight: normal;
    letter-spacing: .03em;
    cursor: pointer;
    transition: all .18s;
    white-space: nowrap;
    line-height: 1.4;
}
.tab-btn.active { font-weight: 700; }

/* ═══ PANELS ════════════════════════════════════════════════════════════════ */
.panel { display: none; padding: 1rem 1.5rem 3rem; width: 100%; max-width: 960px; margin: 0 auto; }
.panel.active { display: block; }

/* ═══ 3-TAGE: Desktop nebeneinander ═════════════════════════════════════════ */
.week-strip {
    display: flex;
    gap: .3rem;
    margin-bottom: .8rem;
    background: var(--card);
    border-radius: var(--radius);
    padding: .55rem .5rem;
    border: 1px solid var(--border);
}
.week-day { flex: 1; text-align: center; min-width: 0; }
.week-day-label { font-size: .6rem; color: var(--muted); display: block; margin-bottom: 2px; }
.week-day-label.today { color: var(--primary); font-weight: 700; }
.week-day-box {
    width: 100%; height: 30px; border-radius: 6px;
    background: #f0eaf8; border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden; font-size: .75rem;
}
.week-day-box.today { background: var(--primary-b); border-color: var(--primary); }
.week-day-box.done  { background: var(--primary-l); }
.week-day-progress  { position: absolute; bottom: 0; left: 0; height: 3px; background: var(--primary); transition: width .4s; }
.week-day-name { font-size: .55rem; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-day-name.done { color: var(--primary); }

/* Tag: 7 klickbare Wochentage */
.day-btns { display: flex; gap: .3rem; margin-bottom: .7rem; }
.day-btn {
    flex: 1; min-width: 0; padding: .45rem .1rem; border: none; border-radius: 10px;
    background: var(--card); color: var(--text); cursor: pointer; transition: all .15s;
    box-shadow: 0 1px 3px rgba(61,43,107,.07);
}
.day-btn.all-done { background: #e8f5e8; }
.day-btn.is-today { background: var(--primary-l); color: var(--primary); outline: 2px solid var(--primary-b); }
.day-btn.sel { background: var(--primary); color: #fff; outline: none; box-shadow: 0 2px 8px rgba(124,92,191,.25); }
.db-wd   { font-size: .62rem; font-weight: 700; letter-spacing: .04em; }
.db-icon { font-size: .8rem; margin: 2px 0; }
.db-date { font-size: .58rem; color: var(--muted); }
.day-btn.all-done .db-date { color: #4a8a4a; }
.day-btn.sel .db-date { color: rgba(255,255,255,.8); }
.db-bar  { height: 2px; border-radius: 1px; margin-top: 3px; background: var(--primary-b); overflow: hidden; }
.db-fill { height: 100%; background: var(--primary); transition: width .3s; }
.day-btn.sel .db-bar  { background: rgba(255,255,255,.4); }
.day-btn.sel .db-fill { background: #fff; }
.empty-hint { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 0; }

.day-card {
    background: var(--card);
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.day-card.today { border: 2px solid var(--primary); box-shadow: 0 4px 18px rgba(124,92,191,.18); }
.day-card-header {
    padding: .55rem .9rem .45rem;
    background: #faf8fd;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: .6rem;
}
.day-card.today .day-card-header { background: var(--primary-l); }
.day-card-title {
    font-size: .8rem; font-weight: 700; color: var(--text);
    letter-spacing: .06em; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
}
.day-card.today .day-card-title { color: var(--primary); }
.day-card-date   { font-size: .68rem; color: var(--muted); margin-top: 1px; }
.day-card-prog   { text-align: right; flex-shrink: 0; }
.day-card-prog-count { font-size: .68rem; font-weight: 700; color: var(--muted); }
.day-card.today .day-card-prog-count { color: var(--primary); }
.day-card-prog-bar   { width: 52px; height: 4px; background: var(--primary-b); border-radius: 2px; overflow: hidden; margin-top: 3px; }
.day-card-prog-fill  { height: 100%; background: #aaa; border-radius: 2px; transition: width .3s; }
.day-card.today .day-card-prog-fill { background: var(--primary); }
.day-card-body { padding: .35rem .8rem .6rem; }

/* ═══ SECTION LABEL ══════════════════════════════════════════════════════════ */
.sl { font-size: .62rem; letter-spacing: .07em; font-weight: 700; padding: .4rem 0 .18rem; }

/* ═══ TASK ROWS ══════════════════════════════════════════════════════════════ */
.tr {
    display: flex; align-items: center; gap: .55rem;
    padding: .5rem .3rem; border-bottom: 1px solid var(--divider);
}
.tr:last-child { border-bottom: none; }
.tr-label  { flex: 1; font-size: .85rem; }
.tr-label.done { text-decoration: line-through; color: var(--muted); }
.defer-btn {
    background: none; border: 1px solid var(--border); border-radius: 5px;
    color: var(--muted); font-size: .6rem; cursor: pointer; padding: .15rem .38rem;
}

/* ═══ CHECKBOX ═══════════════════════════════════════════════════════════════ */
.cb {
    width: 20px; height: 20px; border-radius: 5px; flex-shrink: 0;
    border: 2px solid #c8b8e8; background: transparent;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all .15s;
}
.cb.checked { background: currentColor; border-color: currentColor; }
.check { color: #fff; font-size: .7rem; line-height: 1; display: none; }
.cb.checked .check { display: block; }

/* ═══ TAG ════════════════════════════════════════════════════════════════════ */
.tag { font-size: .6rem; padding: 1px 5px; border-radius: 7px; border: 1px solid; }

/* ═══ PROGRESS BOX ═══════════════════════════════════════════════════════════ */
.progress-box {
    background: var(--card); border-radius: var(--radius);
    padding: .6rem .9rem; margin-bottom: .6rem; border: 1px solid var(--border);
}
.progress-box-top  { display: flex; justify-content: space-between; margin-bottom: .3rem; }
.progress-box-label { font-size: .68rem; color: var(--muted); letter-spacing: .04em; }
.progress-box-count { font-size: .68rem; font-weight: 700; }
.progress-bar       { height: 5px; border-radius: 3px; overflow: hidden; }
.progress-fill      { height: 100%; border-radius: 3px; transition: width .4s; }

/* ═══ LIST ITEMS ════════════════════════════════════════════════════════════ */
/* Desktop: mehrere Spalten für lange Listen */
.list-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .4rem;
}
@media (max-width: 900px) { .list-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .list-grid { grid-template-columns: 1fr; } }

.list-item {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .9rem; margin: .25rem 0;
    background: var(--card); border-radius: var(--radius);
    border: 1px solid var(--border); cursor: pointer;
    box-shadow: var(--shadow); transition: all .15s;
}
.list-item.done { box-shadow: none; }
.list-item-label { flex: 1; font-size: .88rem; }
.list-item-label.done { text-decoration: line-through; color: var(--muted); }

/* ═══ INFO BOX ══════════════════════════════════════════════════════════════ */
.info-box {
    border-radius: var(--radius); padding: .55rem .9rem;
    margin-bottom: .6rem; border: 1px solid; font-size: .72rem;
}

/* ═══ FOOTER HINT ═══════════════════════════════════════════════════════════ */
.footer-hint {
    text-align: center; padding: .5rem 1rem 1rem;
    color: var(--muted); font-size: .7rem; line-height: 2;
}

/* ═══ FOOTER ════════════════════════════════════════════════════════════════ */
footer {
    background: var(--primary-d); color: rgba(255,255,255,.6);
    text-align: center; padding: 1rem; font-size: .85rem; margin-top: auto;
}

/* ═══ LISTEN-DETAILS ════════════════════════════════════════════════════════ */
.li-body { flex: 1; min-width: 0; }
.li-sub  { font-size: .65rem; color: var(--muted); margin-top: 2px; }
.list-item.done .li-sub { display: none; }
.li-date { font-size: .62rem; color: var(--muted); flex-shrink: 0; }
.list-item.big { border-width: 2px; border-color: var(--primary-b); }
.list-item.big .list-item-label { font-weight: 700; }
.hint { font-size: .7rem; color: var(--muted); margin: 0 0 .6rem .2rem; }
.sub-title { font-size: .75rem; font-weight: 700; letter-spacing: .06em; margin: 1.2rem 0 .3rem .2rem; }
.subgroup { margin-bottom: .7rem; }
.sub-head { display: flex; justify-content: space-between; padding: .4rem .2rem .2rem; font-size: .68rem; font-weight: 700; color: #3a7a9a; letter-spacing: .06em; }
.sub-count { font-weight: normal; color: var(--muted); }
.sub-count.all { font-weight: 700; color: #4a8a4a; }
.od-from { font-size: .65rem; color: var(--muted); }

/* ═══ WOCHE ═════════════════════════════════════════════════════════════════ */
.rot-row {
    display: flex; align-items: center; gap: .7rem; padding: .5rem .85rem; margin: .2rem 0;
    background: var(--card); border: 1px solid var(--border); border-radius: 10px;
}
.rot-row.all-done { background: #eae8f5; border-color: #b8b0e8; }
.rot-row.is-today { background: var(--primary-l); border-color: var(--primary); }
.rot-icon  { font-size: 1.1rem; }
.rot-name  { font-size: .85rem; }
.rot-row.is-today .rot-name { font-weight: 700; color: var(--primary); }
.rot-date  { font-size: .65rem; color: var(--muted); }
.rot-count { font-size: .7rem; color: var(--muted); }
.rot-row.all-done .rot-count { color: #4a8a4a; font-weight: 700; }
.fix-list { background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: .2rem; }
.fix-row  { display: flex; align-items: center; gap: .7rem; padding: .5rem .85rem; border-bottom: 1px solid var(--divider); }
.fix-row:last-child { border-bottom: none; }
.fix-row.is-link { background: #eae8f5; cursor: pointer; }
.fix-icon  { font-size: .95rem; }
.fix-label { flex: 1; font-size: .85rem; }
.fix-days  { text-align: right; }
.fix-day   { display: inline-block; background: #eae8f5; border: 1px solid #b8b0e8; border-radius: 5px; padding: 1px 5px; margin: 1px; color: #5a4a9a; font-size: .62rem; }
.fix-link  { display: block; font-size: .6rem; color: #5a4a9a; margin-top: 2px; }
.cal-link  { display: inline-block; background: #6a4db8; color: #fff; border-radius: 20px; padding: .6rem 1.4rem; font-size: .85rem; text-decoration: none; font-weight: 600; }

/* ═══ MONAT ═════════════════════════════════════════════════════════════════ */
.month-btns { display: flex; gap: .4rem; margin-bottom: .8rem; }
.month-btn {
    flex: 1; padding: .55rem .3rem; border-radius: 12px; border: 1px solid var(--border);
    background: var(--card); color: var(--muted); font-size: .78rem; cursor: pointer; line-height: 1.4;
}
.month-btn span { font-size: .62rem; }
.month-btn.sel { border: 2px solid #8a3a9a; background: #f5e8f8; color: #8a3a9a; font-weight: 700; }

/* ═══ WOCHENRÜCKBLICK ═══════════════════════════════════════════════════════ */
.wr-bar { display: flex; justify-content: flex-end; padding: .5rem 1.5rem .2rem; max-width: 960px; margin: 0 auto; width: 100%; }
.wr-open {
    background: linear-gradient(135deg,#c0392b,#e74c3c); color: #fff; border: none; border-radius: 20px;
    padding: .45rem 1.1rem; font-size: .8rem; font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgba(192,57,43,.3);
}
#wr-overlay { display: none; position: fixed; inset: 0; background: rgba(30,10,60,.55); z-index: 100; }
.wr-modal {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: min(92vw,600px); max-height: 85vh; overflow-y: auto;
    background: #fff; border-radius: 18px; box-shadow: 0 8px 40px rgba(0,0,0,.25);
}
.wr-head { background: linear-gradient(135deg,#c0392b,#e74c3c); padding: 1.1rem 1.4rem; border-radius: 18px 18px 0 0; display: flex; align-items: center; gap: .7rem; }
.wr-title { color: #fff; font-family: 'Nunito',sans-serif; font-weight: 800; font-size: 1.1rem; }
.wr-sub   { color: rgba(255,255,255,.75); font-size: .72rem; }
.wr-close { background: rgba(255,255,255,.2); border: none; border-radius: 50%; width: 30px; height: 30px; color: #fff; font-size: 1rem; cursor: pointer; }
#wr-body  { padding: 1rem 1.2rem 1.5rem; }
.wr-empty { text-align: center; color: var(--muted); padding: 2rem; }
.wr-day   { font-size: .72rem; font-weight: 700; color: #c0392b; letter-spacing: .06em; margin: .8rem 0 .35rem; padding: .25rem .6rem; background: #fde8e8; border-radius: 6px; }
.wr-row   { display: flex; align-items: center; gap: .7rem; padding: .5rem .6rem; border-bottom: 1px solid #f5f0ff; cursor: pointer; border-radius: 8px; }
.wr-cb    { width: 20px; height: 20px; border-radius: 5px; flex-shrink: 0; border: 2px solid #c8b8e8; display: flex; align-items: center; justify-content: center; }
.wr-label { flex: 1; font-size: .88rem; }
.wr-row.done { background: #f0faf0; }
.wr-row.done .wr-cb { background: #27ae60; border-color: #27ae60; }
.wr-row.done .wr-cb::after { content: '✓'; color: #fff; font-size: .7rem; }
.wr-row.done .wr-label { text-decoration: line-through; color: #aaa; }
.wr-done-btn { background: var(--primary-l); color: var(--primary); border: none; border-radius: 20px; padding: .5rem 1.4rem; font-size: .85rem; cursor: pointer; }

/* ═══ RESPONSIVE UTILITIES ══════════════════════════════════════════════════ */
@media (max-width: 600px) {
    .badges { gap: .3rem; padding: .6rem .7rem .3rem; }
    .badge-label { font-size: .5rem; }
    header { padding: 1rem 1rem .8rem; }
    .panel { padding: .7rem .7rem 3rem; }
    .tab-btn { min-width: 46px; font-size: .53rem; }
}

@media (min-width: 1000px) {
    .badges { gap: .8rem; }
    .badge-icon  { font-size: 1.3rem; }
    .badge-count { font-size: .85rem; }
    .badge-label { font-size: .65rem; }
    .tr-label    { font-size: .92rem; }
    .list-item-label { font-size: .95rem; }
    .day-card-body { padding: .4rem 1rem .8rem; }
}

/* ═══ LOGIN ═════════════════════════════════════════════════════════════════ */
.login-box {
    width: min(100% - 32px, 340px); margin: 2.5rem auto; background: var(--card);
    border: 1px solid var(--border); border-radius: 14px; padding: 1.4rem; box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: .7rem;
}
.login-box label { font-weight: 700; color: var(--primary-d); font-size: .9rem; }
.login-box input { border: 1px solid var(--primary-b); border-radius: 8px; padding: .65rem .8rem; font-size: 1rem; font-family: inherit; }
.login-box button { background: var(--primary); color: #fff; border: none; border-radius: 20px; padding: .65rem; font-size: .95rem; font-weight: 600; cursor: pointer; }
.login-error { color: #c0392b; font-size: .8rem; }
