* {
    box-sizing: border-box;
}

:root {
    --bg-start: #f8fafc;
    --bg-end: #eef2ff;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 100%);
}

.page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 28px;
}

.card {
    width: 100%;
    max-width: 760px;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 22px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.auth-card {
    max-width: 450px;
}

.card-wide {
    max-width: 1240px;
}

.header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 24px;
}

h1 {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.15;
}

h2 {
    margin: 22px 0 12px;
    font-size: 22px;
}

p {
    margin: 0;
    color: var(--muted);
}

a {
    color: var(--primary-dark);
}

.logout {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 12px;
    background: #111827;
    color: #ffffff;
    text-decoration: none;
    white-space: nowrap;
}

.add-form,
.category-form,
.filter-form,
.auth-form {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    align-items: center;
}

.auth-form {
    margin-top: 18px;
    flex-direction: column;
    align-items: stretch;
}

.auth-actions {
    margin-top: 10px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
    background: #fff;
}

input:focus,
select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

button {
    border: 0;
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--primary);
    color: #ffffff;
    cursor: pointer;
    font-size: 15px;
    transition: background-color .2s ease, transform .08s ease;
}

button:hover {
    background: var(--primary-dark);
}

button:active {
    transform: translateY(1px);
}

.logout:hover {
    opacity: .92;
}

.danger {
    background: var(--danger);
}

.danger:hover {
    background: var(--danger-dark);
}

.error {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fee2e2;
    color: #991b1b;
}

.empty {
    padding: 18px;
    border-radius: 12px;
    background: #f8fafc;
    text-align: center;
    border: 1px dashed var(--border);
}

.filter-form label {
    color: #334155;
    font-size: 14px;
    white-space: nowrap;
}

.task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.task {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #e5e7eb;
}

.task-title {
    font-size: 17px;
    word-break: break-word;
}

.task-category {
    margin-top: 4px;
    font-size: 13px;
    color: var(--muted);
}

.task.done .task-title {
    color: #94a3b8;
    text-decoration: line-through;
}

.task-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.task-actions form {
    margin: 0;
}

@media (max-width: 768px) {
    body {
        font-size: 18px;
    }

    .page {
        align-items: stretch;
        padding: 0;
    }

    .card {
        min-height: 100vh;
        max-width: none;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        padding: clamp(18px, 4vw, 26px);
        box-shadow: none;
    }

    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    h1 {
        font-size: clamp(34px, 8vw, 42px);
        margin-bottom: 10px;
    }

    h2 {
        font-size: clamp(28px, 7vw, 34px);
        margin-top: 24px;
    }

    p,
    .task-category,
    .filter-form label {
        font-size: 16px;
    }

    .logout,
    button,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    select {
        min-height: 54px;
        padding: 14px 16px;
        font-size: 18px;
        border-radius: 14px;
    }

    .add-form,
    .filter-form,
    .category-form {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .task {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px 0;
    }

    .task-title {
        font-size: 20px;
        line-height: 1.3;
    }

    .task-actions {
        width: 100%;
        gap: 10px;
    }

    .task-actions form {
        flex: 1;
    }

    .task-actions button {
        width: 100%;
    }
}


.task-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.task-table th,
.task-table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
    white-space: nowrap;
}

.task-table th a {
    text-decoration: none;
}

.task-table .task {
    display: table-row;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.rename-form {
    display: flex;
    gap: 10px;
    width: 100%;
}

.category-actions {
    display: flex;
    gap: 8px;
}

button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    font-family: inherit;
    resize: vertical;
}

textarea:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.button-link {
    display: inline-block;
    border: 0;
    border-radius: 12px;
    padding: 12px 14px;
    background: #0f766e;
    color: #ffffff;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.task-edit-form {
    display: grid;
    gap: 12px;
}

.task-edit-form label {
    display: grid;
    gap: 8px;
    color: #334155;
}
