:root {
    --bg: #FAFAF8;
    --surface: #FFFFFF;
    --text: #2B2B29;
    --text-muted: #7A7A74;
    --border: #E8E6E0;
    --accent: #4C8577;
    --accent-hover: #3D6E62;
    --accent-soft: #E6F0EC;
    --warn: #B9863E;
    --warn-soft: #FBF1E2;
    --danger: #B25050;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-header {
    max-width: 640px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 1rem;
}

.header-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.app-header h1 {
    font-size: 1.9rem;
    font-weight: 600;
    margin: 0 0 1.25rem;
}

.logout-link {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
}
.logout-link:hover { color: var(--accent); }

.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    background: none;
    border: none;
    font-size: 0.95rem;
    color: var(--text-muted);
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

main {
    max-width: 640px;
    margin: 0 auto;
    padding: 1rem 1.5rem 4rem;
}

.view.hidden { display: none; }

.empty-state, .section-note {
    color: var(--text-muted);
    font-size: 0.95rem;
    padding: 1.5rem 0;
}

.banner {
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    font-size: 0.92rem;
    margin-bottom: 1rem;
}

.banner-warn {
    background: var(--warn-soft);
    color: var(--warn);
}

.task-list {
    list-style: none;
    margin: 1rem 0;
    padding: 0;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.task-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
    transition: opacity 0.5s ease 0.15s;
}

.task-row:last-child { border-bottom: none; }

.task-row.completing {
    pointer-events: none;
}

.task-row.completing .task-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-row.completing {
    opacity: 0;
}

.task-title {
    flex: 1;
    font-size: 1.02rem;
    word-break: break-word;
}

.task-time {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-rollover {
    font-size: 0.75rem;
    color: var(--warn);
    background: var(--warn-soft);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* Large, satisfying checkbox */
.task-check {
    position: relative;
    display: inline-flex;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
}

.task-check input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    inset: 0;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.task-check input:checked ~ .checkmark {
    background: var(--accent);
    border-color: var(--accent);
}

.checkmark::after {
    content: "";
    position: absolute;
    display: none;
    left: 9px;
    top: 4px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.task-check input:checked ~ .checkmark::after { display: block; }

.today-summary {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0 0.2rem;
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-block;
    border: none;
    border-radius: 999px;
    font-size: 0.95rem;
    padding: 0.75rem 1.4rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-primary {
    background: var(--accent);
    color: white;
}
.btn-primary:hover { background: var(--accent-hover); }

.add-form {
    display: flex;
    gap: 0.6rem;
    margin: 1rem 0 1.25rem;
}

.add-form input[type="text"] {
    flex: 1;
    min-width: 0;
}

.add-form input[type="number"] {
    width: 90px;
}

input[type="text"], input[type="number"], select {
    font-size: 0.95rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
}

input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn-icon {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem;
    padding: 0.32rem 0.55rem;
    cursor: pointer;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-icon:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.btn-icon:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-delete:hover { border-color: var(--danger); color: var(--danger); background: none; }

.task-row.grave .task-title { color: var(--text-muted); }

/* Εργασίες/Σήμερα/Νεκροταφείο rows: title (and its badges) can wrap onto
   multiple lines, but the row itself never does — the time/action-button
   cluster stays pinned at the top-right at all times, and the checkbox
   (where present) stays glued to the start of the title's first line
   rather than ever landing alone on its own line. */
.task-item {
    align-items: flex-start;
    flex-wrap: nowrap;
}

.task-item-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
}

.task-item-info .task-title {
    flex: 1 1 120px;
    min-width: 0;
}

.task-item-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.badge-recurrence {
    font-size: 0.75rem;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* Deliberately low-key: the manual "send this back to Tasks" action. It
   should be usable, not inviting — no border, muted by default, only a
   little more visible on hover/focus. */
.btn-ghost {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.15rem 0.3rem;
    cursor: pointer;
    opacity: 0.5;
    flex-shrink: 0;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover, .btn-ghost:focus-visible {
    opacity: 1;
    color: var(--text);
}

/* Minimal recurrence picker: one button that cycles none/1/7/30 days on
   click, instead of a dropdown. */
.recurrence-cycle {
    display: inline-flex;
}

.btn-recurrence-cycle {
    min-width: 3.8rem;
    text-align: center;
}

/* Inline edit form, replaces a row's contents while editing */
.edit-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.edit-form .edit-title {
    flex: 1 1 140px;
    min-width: 0;
}

.edit-form .edit-minutes {
    width: 80px;
}

.edit-form input, .edit-form select {
    padding: 0.5rem 0.6rem;
    font-size: 0.9rem;
}

.edit-form-actions {
    display: flex;
    gap: 0.4rem;
    margin-left: auto;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    background: var(--text);
    color: white;
    padding: 0.75rem 1.2rem;
    border-radius: 999px;
    font-size: 0.9rem;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    z-index: 100;
}

.toast.hidden { display: none; }

.login-body {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
}

.login-page {
    width: 100%;
    max-width: 360px;
    padding: 1.5rem;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-card h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    text-align: center;
}

.login-card label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.login-card input {
    width: 100%;
}

.login-card .btn {
    width: 100%;
    margin-top: 0.25rem;
}

@media (max-width: 480px) {
    .app-header, main { padding-left: 1.1rem; padding-right: 1.1rem; }
    .add-form { flex-wrap: wrap; }
    .add-form input[type="number"] { width: 100%; }
    .add-form select { width: 100%; }
    .add-form button { width: 100%; }
    .task-row { padding: 0.85rem; }

    .edit-form {
        flex-direction: column;
        align-items: stretch;
    }

    .edit-form-actions {
        margin-left: 0;
        justify-content: flex-end;
    }
}
