/* =========================================================
   Variablen
========================================================= */

:root {
    --bg: #f7f6f2;
    --card: #fff;
    --text: #303432;
    --muted: #8a918d;
    --line: #e7e5df;
    --accent: #76658f;
    --soft: #eeeaf3;
}


/* =========================================================
   Basis
========================================================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 17px/1.45 Calibri, Arial, sans-serif;
}

button,
input {
    font: inherit;
    color: inherit;
}


/* =========================================================
   App & Grundlayout
========================================================= */

.app {
    max-width: 1500px;
    margin: auto;
    padding: 30px 34px;
}

.layout {
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 22px;
}

.side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(45, 55, 50, .055);
}


/* =========================================================
   Kopfbereich
========================================================= */

.top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 30px;
    margin-bottom: 24px;
}

.brand {
    font-size: 27px;
    font-weight: 750;
}

.intro {
    margin-top: 7px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
}

.today {
    color: var(--muted);
    font-size: 14px;
    padding: 0 4px;
}


/* =========================================================
   Kalender
========================================================= */

.calendar {
    padding: 17px;
}

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

.nav {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 19px;
}

.week,
.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.week {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 5px;
}

.day {
    height: 27px;
    border: 0;
    background: transparent;
    border-radius: 50%;
    font-size: 14px;
    position: relative;
}

.day.now {
    background: var(--soft);
    color: var(--accent);
    font-weight: 800;
}

.day.due {
    font-weight: 900;
    cursor: pointer;
}

.day.due::after {
    content: "";
    width: 3px;
    height: 3px;
    background: var(--accent);
    border-radius: 50%;
    position: absolute;
    bottom: 2px;
    left: calc(50% - 1px);
}


/* =========================================================
   Rückblick & Abmelden
========================================================= */

.review {
    padding: 13px;
    text-align: left;
    border: 0;
    cursor: pointer;
    font-weight: 650;
}

.review:hover {
    color: var(--accent);
}

.reviewnav {
    display: none;
    padding: 13px;
}

.reviewnav.show {
    display: block;
}

.reviewnavrow {
    display: grid;
    grid-template-columns: 26px 1fr 26px;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.reviewnav button {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 19px;
}

.reviewnav button:disabled {
    opacity: .25;
    cursor: default;
}

.reviewnav strong {
    font-size: 14px;
    font-weight: 800;
}

.logout {
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
    padding: 0 4px;
}

.logout:hover {
    color: var(--accent);
}


/* =========================================================
   Widgets / Pseudo-Masonry
========================================================= */

.widgets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.widgetcol {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.widget {
    padding: 17px 17px 13px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.title-wrap {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 12px;
}

.title {
    font-size: 19px;
    font-weight: 800;
    margin: 0;
    outline: none;
    width: auto;
    flex: 1;
}

.title-edit {
    flex: 0 0 auto;
    margin-left: auto;
    color: #aab0ad;
    font-size: 14px;
    font-weight: 400;
    opacity: .5;
    cursor: pointer;
}

.title {
    font-size: 19px;
    font-weight: 800;
    margin: 0;
    outline: none;
	width: auto;
	flex: 0 1 auto;
}

.title:focus {
    background: var(--soft);
}

.title-edit {
    flex: 0 0 auto;
    color: #aab0ad;
    font-size: 14px;
    font-weight: 400;
    opacity: .5;
    cursor: pointer;
}

.title-wrap:hover .title-edit,
.title:focus + .title-edit {
    color: var(--accent);
    opacity: 1;
}


/* =========================================================
   Aufgaben
========================================================= */

.tasks {
    display: flex;
    flex-direction: column;
    min-height: 34px;
}

.tasks.drag-over {
    background: var(--soft);
    border-radius: 8px;
}

.task {
    display: grid;
    grid-template-columns: 20px 24px 1fr 25px 25px;
    align-items: start;
    padding: 6px 0;
    border-radius: 7px;
}

.task.dragging {
    opacity: .35;
}

.task.drop-before {
    box-shadow: inset 0 2px 0 var(--accent);
}

.check {
    appearance: none;
    width: 17px;
    height: 17px;
    border: 1.5px solid #a9afac;
    border-radius: 50%;
    margin: 2px 0 0;
    cursor: pointer;
}

.check:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.check:checked::after {
    content: "✓";
    display: grid;
    place-items: center;
    color: white;
    font-size: 11px;
    font-weight: 900;
}

.task.done .txt {
    color: #a4aaa7;
    text-decoration: line-through;
}

.txt {
    outline: none;
}


/* =========================================================
   Aufgaben-Steuerung
========================================================= */

.handle,
.clock,
.delete {
    border: 0;
    background: transparent;
    color: #aab0ad;
    cursor: pointer;
    opacity: .18;
    padding: 0;
}

.handle {
    cursor: grab;
    font-size: 15px;
    line-height: 20px;
}

.handle:active {
    cursor: grabbing;
}

.task:hover .handle,
.task:hover .clock,
.clock.set {
    opacity: 1;
    color: var(--accent);
}

.task:hover .delete {
    opacity: 1;
}

.delete:hover {
    color: #6f617c;
}

.add {
    margin-top: auto;
    padding-top: 10px;
    border: 0;
    background: transparent;
    text-align: left;
    color: var(--muted);
    cursor: pointer;
}

.add:hover {
    color: var(--accent);
}

.new-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    align-items: center;
    gap: 8px;
    width: 100%;
    border-bottom: 1px solid var(--accent);
}

.new-wrap .new {
    width: auto;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 6px 0;
    background: transparent;
}

.new-wrap .new-submit {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-size: 17px;
    font-weight: 700;
    line-height: 30px;
    text-align: center;
}

.new-submit:hover,
.new-submit:focus {
    opacity: .85;
}

/* =========================================================
   Fortschritt
========================================================= */

.progress {
    width: min(560px, 45vw);
    margin: 0 0 2px auto;
}

.message {
    margin-bottom: 8px;
}

.prow {
    display: flex;
    align-items: center;
    gap: 12px;
}

.track {
    height: 10px;
    background: #e5e4df;
    border-radius: 99px;
    overflow: hidden;
    flex: 1;
}

.fill {
    height: 100%;
    background: var(--accent);
    transition: .25s;
}

.pct {
    font-size: 16px;
    color: var(--muted);
    min-width: 44px;
}


/* =========================================================
   Popup & Undo
========================================================= */

.pop {
    position: fixed;
    z-index: 5;
    width: 245px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 14px 40px #0002;
    padding: 13px;
    display: none;
}

.pop strong {
    display: block;
    margin-bottom: 6px;
}

.pop div {
    font-size: 13px;
    padding: 4px 0;
}

.undo {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 20;
    background: #353536;
    color: white;
    border-radius: 10px;
    padding: 10px 13px;
    box-shadow: 0 10px 30px #0003;
    display: none;
}

.undo button {
    border: 0;
    background: transparent;
    color: #ddd0f0;
    font-weight: 700;
    cursor: pointer;
    margin-left: 10px;
}


/* =========================================================
   Dialog
========================================================= */

dialog {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 20px 70px #0003;
}

dialog::backdrop {
    background: #2223;
}

.dlg {
    padding: 6px;
    min-width: 290px;
}

.dlg input {
    width: 100%;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.actions button {
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

.actions .save {
    background: var(--accent);
    color: white;
}


/* =========================================================
   Rückblick-Modus
========================================================= */

.reviewmode .task {
    grid-template-columns: 24px 1fr 25px;
}

.reviewmode .task .reviewcheck {
    width: 17px;
    height: 17px;
    border: 1.5px solid #a9afac;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin-top: 2px;
    font-size: 11px;
}

.reviewmode .task.done .reviewcheck {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.reviewmode .task .reviewdeadline {
    color: var(--accent);
    font-size: 13px;
    text-align: center;
}


/* =========================================================
   Schnurpsel-Maskottchen
========================================================= */

.mascot {
    position: fixed;
    left: 30px;
    bottom: 20px;
    width: 190px;
    height: auto;
    z-index: 1;
    pointer-events: none;
}


/* Bis einschließlich Tablet / schmales Fenster:
   Maskottchen ans Ende der Seite setzen
========================================================= */

@media (max-width: 1250px) {

    .mascot {
        position: static;
        display: block;
        width: 160px;
        margin: 70px auto 20px;
    }
}


/* =========================================================
   Login
========================================================= */

.loginpage {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.loginwrap {
    width: min(420px, 100%);
}

.loginbox {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 12px 35px rgba(45, 55, 50, .07);
    padding: 34px;
}

.loginbrand {
    font-size: 30px;
    font-weight: 800;
    margin-bottom: 4px;
}

.loginintro {
    color: var(--muted);
    margin-bottom: 28px;
}

.loginbox label:not(.remember) {
    display: block;
    font-weight: 650;
    font-size: 14px;
    margin: 16px 0 6px;
}

.loginbox input[type="text"],
.loginbox input[type="password"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: white;
    padding: 11px 12px;
    outline: none;
}

.loginbox input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--soft);
}

.remember {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 14px;
    margin: 16px 0;
}

.loginbutton {
    width: 100%;
    border: 0;
    border-radius: 9px;
    background: var(--accent);
    color: white;
    font-weight: 750;
    padding: 11px 14px;
    cursor: pointer;
}

.lostpass {
    display: block;
    text-align: center;
    margin-top: 18px;
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
}

.lostpass:hover {
    color: var(--accent);
}


/* =========================================================
   Responsive – Mittel
   Kalender links + 1 Widgetspalte
========================================================= */

@media (max-width: 1250px) and (min-width: 601px) {

    .layout {
        grid-template-columns: 220px 1fr;
    }

    .widgets {
        grid-template-columns: 1fr;
    }

    .progress {
        width: min(480px, 48vw);
    }
}


/* =========================================================
   Responsive – Handy
   Alles untereinander
========================================================= */

@media (max-width: 600px) {

    body {
        font-size: 16px;
    }

    .app {
        padding: 20px 16px;
    }

    .top {
        display: block;
        margin-bottom: 18px;
    }

    .brand {
        font-size: 25px;
    }

    .intro {
        font-size: 13px;
    }

    .progress {
        width: 100%;
        margin-top: 20px;
    }

    .layout {
        display: block;
    }

    .side {
        gap: 12px;
        margin-bottom: 16px;
    }

    .calendar {
        max-width: 360px;
        width: 100%;
        margin: 0 auto;
    }

    .today {
        text-align: center;
    }

    .review {
        width: 100%;
    }

    .reviewnav {
        width: 100%;
    }

    .logout {
        text-align: center;
        padding: 6px;
    }

    .widgets {
        grid-template-columns: 1fr;
    }

    .widgetcol {
        gap: 14px;
    }

    .widget {
        min-height: 0;
    }

    .task {
        grid-template-columns:
            24px
            28px
            minmax(0, 1fr)
            32px
            32px;
    }

    .handle,
    .clock,
    .delete {
        opacity: .65;
        min-height: 30px;
    }

    .add {
        min-height: 40px;
    }
}