:root {
    --bg: #d8d1c3;
    --paper: #f7f1df;
    --ink: #2f3540;
    --blue: #365394;
    --line: rgba(73, 102, 143, .16);
    --muted: #8a877e;
    --danger: #9b4646;
    --shadow: rgba(45, 38, 30, .18);

    /* Fuente manuscrita principal */
    --hand-font: "LetraAndre", "Segoe Print", "Comic Sans MS", cursive;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background:
        radial-gradient(
            circle at 20% 10%,
            rgba(255, 255, 255, .45),
            transparent 25%
        ),
        linear-gradient(
            135deg,
            #d7d0c2,
            #c8c0b2
        );

    color: var(--ink);
    font-family: Arial, sans-serif;
}

.hidden {
    display: none !important;
}


/* =========================
   ESTRUCTURA PRINCIPAL
   ========================= */

.app-shell {
    min-height: 100vh;
    padding: 36px 16px;

    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.paper {
    width: min(880px, 100%);
    min-height: 78vh;

    padding: 44px 54px 64px;

    background:
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent 34px,
            var(--line) 35px,
            transparent 36px
        ),
        var(--paper);

    border: 1px solid rgba(80, 70, 50, .16);

    box-shadow:
        0 14px 35px var(--shadow);

    border-radius:
        5px 9px 7px 4px;

    position: relative;
}


/* Pequeña textura del papel */
.paper::before {
    content: "";

    position: absolute;
    inset: 0;

    pointer-events: none;

    opacity: .18;

    background-image:
        radial-gradient(
            circle at 15% 25%,
            rgba(90, 70, 40, .12) 0 1px,
            transparent 1.5px
        ),
        radial-gradient(
            circle at 75% 55%,
            rgba(90, 70, 40, .09) 0 1px,
            transparent 1.5px
        );

    background-size:
        31px 37px,
        47px 43px;
}

.paper > * {
    position: relative;
    z-index: 1;
}


/* =========================
   CABECERA
   ========================= */

.paper-header {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 28px;
}

.eyebrow {
    font-size: 13px;
    color: var(--muted);

    letter-spacing: .08em;
}

.paper-header h1 {
    margin: 2px 0 0;

    color: var(--blue);

    font-family: var(--hand-font);

    font-size: clamp(27px, 5vw, 42px);

    font-weight: 500;

    letter-spacing: 0;
}

.header-actions {
    display: flex;

    align-items: center;

    gap: 12px;

    font-size: 13px;

    color: var(--muted);
}

.quiet-link {
    color: inherit;

    text-decoration: none;

    border-bottom:
        1px dashed currentColor;
}


/* =========================
   NUEVA TAREA
   ========================= */

.quick-add {
    display: grid;

    grid-template-columns:
        28px 1fr 42px;

    gap: 8px;

    align-items: start;

    margin:
        8px 0 18px;
}

.plus {
    font-family: var(--hand-font);

    font-size: 30px;

    color: var(--blue);

    transform: rotate(-2deg);
}

.new-task-wrap {
    min-width: 0;
}

.quick-add input {
    width: 100%;

    border: 0;

    border-bottom:
        2px solid rgba(51, 79, 141, .35);

    background: transparent;

    padding: 8px 4px;

    font-family: var(--hand-font);

    font-size: 23px;

    color: var(--blue);

    outline: none;

    letter-spacing: 0;

    line-height: 1.25;
}

.quick-add input::placeholder {
    color:
        rgba(51, 79, 141, .42);
}

.calendar-button,
.task-actions button,
.check-btn {
    border: 0;

    background: transparent;

    color: var(--blue);

    cursor: pointer;
}

.calendar-button {
    font-size: 25px;

    opacity: .6;

    padding-top: 6px;
}

.new-task-date {
    font-size: 12px;

    color: var(--muted);

    padding:
        4px 4px 0;
}


/* =========================
   TITULOS DE SECCION
   ========================= */

.section-title {
    display: flex;

    justify-content: space-between;

    margin:
        24px 0 8px;

    color: var(--muted);

    font-size: 13px;

    text-transform: uppercase;

    letter-spacing: .09em;
}

.counter {
    text-transform: none;

    letter-spacing: 0;
}


/* =========================
   LISTA DE TAREAS
   ========================= */

.task-list {
    min-height: 12px;
}

.task-row {
    min-height: 54px;

    display: grid;

    grid-template-columns:
        34px 1fr auto;

    align-items: start;

    gap: 10px;

    padding:
        7px 0 5px;
}


/* Circulo de tarea */
.check-btn {
    width: 23px;
    height: 23px;

    margin-top: 7px;

    border:
        2px solid var(--blue);

    border-radius:
        44% 51% 48% 53%;

    transform:
        rotate(-3deg);

    position: relative;
}


/* Marca realizada */
.task-row.done .check-btn::after {
    content: "✓";

    position: absolute;

    left: 1px;
    top: -12px;

    font-family: var(--hand-font);

    font-size: 30px;

    transform:
        rotate(-8deg);
}

.task-body {
    min-width: 0;
}


/* TEXTO PRINCIPAL DE LA TAREA */
.task-text {
    position: relative;

    display: block;

    min-height: 32px;

    color: var(--blue);

    font-family: var(--hand-font);

    font-size: 27px;

    line-height: 1.32;

    /*
       Importante para LetraAndre:
       no añadimos separación artificial
    */
    letter-spacing: 0;

    font-kerning: normal;

    overflow-wrap: anywhere;

    word-break: normal;
}


/* Tarea completada */
.task-row.done .task-text {
    opacity: .52;
}


/* Tachado estilo bolígrafo */
.task-row.done .task-text::after {
    content: "";

    position: absolute;

    left: -4px;
    right: -5px;

    top: 48%;

    height: 2px;

    background:
        rgba(51, 79, 141, .78);

    transform:
        rotate(-1deg);

    pointer-events: none;
}


/* Fecha de la tarea */
.task-meta {
    margin-top: 0;

    font-size: 12px;

    color: var(--muted);

    font-family:
        Arial,
        sans-serif;
}


/* =========================
   ACCIONES DE TAREA
   ========================= */

.task-actions {
    display: flex;

    gap: 2px;

    opacity: 0;

    transition:
        opacity .15s;
}

.task-row:hover .task-actions,
.task-row:focus-within .task-actions {
    opacity: .78;
}

.task-actions button {
    font-size: 19px;
}

.task-delete-btn {
    color:
        var(--danger) !important;
}

.later-section {
    margin-top: 30px;
}


/* =========================
   MINI CALENDARIO
   ========================= */

.calendar-overlay {
    position: fixed;

    inset: 0;

    background:
        rgba(35, 31, 26, .28);

    display: grid;

    place-items: center;

    padding: 18px;

    z-index: 30;
}

.mini-calendar {
    width:
        min(350px, 100%);

    background:
        #fbf6e7;

    border:
        1px solid rgba(70, 62, 48, .2);

    border-radius: 10px;

    box-shadow:
        0 18px 45px
        rgba(32, 28, 23, .28);

    padding: 15px;

    color: var(--ink);
}

.calendar-head {
    display: grid;

    grid-template-columns:
        42px 1fr 42px;

    align-items: center;
}

.calendar-head button,
.calendar-quick button,
.calendar-footer button {
    border: 0;

    background: transparent;

    cursor: pointer;

    color: var(--blue);

    font-size: 18px;
}

.calendar-month {
    text-align: center;

    font-family:
        Arial,
        sans-serif;

    color: var(--blue);

    font-size: 17px;
}

.weekdays,
.calendar-days {
    display: grid;

    grid-template-columns:
        repeat(7, 1fr);

    gap: 3px;
}

.weekdays {
    margin:
        12px 0 5px;

    color: var(--muted);

    font-size: 11px;

    text-align: center;
}

.cal-day {
    aspect-ratio: 1;

    border: 0;

    border-radius: 50%;

    background: transparent;

    cursor: pointer;

    font: inherit;

    color: #4c4b47;
}

.cal-day:hover {
    background:
        rgba(54, 83, 148, .10);
}

.cal-day.muted {
    opacity: .32;
}

.cal-day.today {
    box-shadow:
        inset 0 0 0 1px
        rgba(54, 83, 148, .4);
}

.cal-day.selected {
    background:
        var(--blue);

    color: #fff;
}

.calendar-time-row {
    display: flex;

    align-items: center;

    justify-content: center;

    gap: 6px;

    margin:
        12px 0 8px;

    color: var(--muted);

    font-size: 13px;
}

.calendar-time-row select {
    border:
        1px solid
        rgba(54, 83, 148, .25);

    background:
        #fffaf0;

    padding:
        5px 8px;

    border-radius: 6px;

    color: var(--ink);
}

.calendar-quick {
    display: flex;

    justify-content: center;

    gap: 14px;

    border-top:
        1px dashed
        rgba(54, 83, 148, .25);

    padding-top: 10px;
}

.calendar-quick button {
    font-size: 13px;

    border-bottom:
        1px dotted currentColor;
}

.calendar-footer {
    display: flex;

    justify-content: flex-end;

    gap: 8px;

    margin-top: 14px;
}

.calendar-footer button {
    font-size: 14px;

    padding:
        7px 11px;

    border-radius: 7px;
}

.calendar-footer .primary {
    background:
        var(--blue);

    color: white;
}


/* =========================
   LOGIN
   ========================= */

.login-page {
    display: grid;

    place-items: center;

    min-height: 100vh;

    padding: 20px;
}

.login-card {
    min-height: auto;

    max-width: 470px;
}

.login-card h1 {
    text-align: center;

    margin:
        0 0 24px;

    color: var(--blue);

    font-family:
        var(--hand-font);

    font-size: 42px;

    font-weight: 500;

    letter-spacing: 0;
}

.login-form {
    display: grid;

    gap: 14px;
}

.login-form input {
    width: 100%;

    border: 0;

    border-bottom:
        1px solid
        rgba(54, 83, 148, .35);

    background: transparent;

    padding:
        10px 4px;

    font-size: 17px;

    outline: none;
}

.login-form button {
    justify-self: end;

    border: 0;

    background: transparent;

    color: var(--blue);

    font-size: 17px;

    cursor: pointer;
}

.login-error {
    color:
        var(--danger);
}


/* =========================
   MOVIL
   ========================= */

@media (max-width: 650px) {

    .app-shell {
        padding: 0;
    }

    .paper {
        min-height: 100vh;

        border-radius: 0;

        padding:
            28px 20px 50px;

        box-shadow: none;
    }

    .paper-header {
        margin-bottom: 20px;
    }

    .header-actions span {
        display: none;
    }

    .quick-add {
        grid-template-columns:
            24px 1fr 38px;
    }

    .quick-add input {
        font-size: 22px;
    }

    .task-text {
        font-size: 25px;

        letter-spacing: 0;

        line-height: 1.35;
    }

    .task-actions {
        opacity: .55;
    }

    .section-title {
        margin-top: 20px;
    }
}
