* {
    box-sizing: border-box;
}

:root {
    --ink: #11110f;
    --muted: #68645d;
    --paper: #fbfaf6;
    --surface: #ffffff;
    --line: #d8d3c8;
    --line-strong: #11110f;
    --field: #f6f3eb;
    --focus: #b58b44;
}

html {
    min-height: 100%;
    background: var(--paper);
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(251, 250, 246, 0.96)),
        var(--paper);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.icon-sprite {
    display: none;
}

a {
    color: inherit;
    text-underline-offset: 0.18em;
}

main {
    width: min(100% - 32px, 1180px);
    margin: 32px auto 56px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1,
h2,
.topbar strong,
.login h1 {
    letter-spacing: 0;
}

h1 {
    margin-bottom: 20px;
    font-size: 44px;
    line-height: 1.05;
}

h2 {
    margin-bottom: 18px;
    font-size: 20px;
    line-height: 1.2;
}

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

.login {
    width: min(100% - 32px, 430px);
    margin: 14vh auto 0;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    box-shadow: 8px 8px 0 var(--ink);
}

.login h1 {
    margin-bottom: 12px;
    font-size: 56px;
}

.login p {
    margin-bottom: 24px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 18px clamp(16px, 4vw, 32px);
    background: var(--surface);
    border-bottom: 1px solid var(--line-strong);
}

.topbar strong {
    display: block;
    font-size: 22px;
    line-height: 1;
}

.topbar span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.topbar nav,
.filters,
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.topbar nav a {
    padding: 5px 0;
    color: var(--ink);
    font-size: 14px;
}

.filters {
    margin-bottom: 20px;
}

.compact-section {
    padding-block: 16px;
}

.owner-filter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.owner-filter label {
    margin: 0;
}

.filters a,
.button,
button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 0;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.filters a:hover,
.button:hover,
button:hover {
    transform: translate(-1px, -1px);
}

.filters a.active,
.button,
button {
    background: var(--ink);
    color: var(--surface);
}

.filters a.active:hover,
.button:hover,
button:hover {
    background: #2b2924;
}

button:disabled,
button:disabled:hover {
    border-color: var(--line);
    background: var(--field);
    color: var(--muted);
    cursor: not-allowed;
    transform: none;
}

.icon-button {
    display: inline-flex;
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--line-strong);
    background: var(--ink);
    color: var(--surface);
    cursor: pointer;
    text-decoration: none;
}

.icon-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.icon-button:hover {
    background: #2b2924;
    transform: translate(-1px, -1px);
}

section,
.task {
    margin-bottom: 22px;
    padding: clamp(18px, 3vw, 24px);
    background: var(--surface);
    border: 1px solid var(--line);
}

section > section,
section .task {
    background: var(--paper);
}

.task {
    border-color: var(--line-strong);
}

.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 220px));
    justify-content: start;
    gap: 0;
    margin: 0;
    padding: 0;
}

.task-card {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    min-width: 0;
    min-height: 180px;
    height: 100%;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line-strong);
    background: var(--paper);
    color: var(--ink);
    box-shadow: none;
}

.task-card h3 {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    font-size: 17px;
    line-height: 1.2;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.progress-badge,
.status-badge {
    display: inline-flex;
    width: fit-content;
    min-height: 26px;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.status-badge {
    text-transform: capitalize;
}

.status-badge-open {
    background: #dff3c4;
    color: var(--ink);
}

.status-badge-closed {
    background: var(--ink);
    color: var(--surface);
}

.status-badge-archived {
    background: #cfe9ff;
    color: var(--ink);
}

.task-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.task-open-link {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border: 1px solid var(--line-strong);
    background: var(--ink);
    color: var(--surface);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition: background 140ms ease, transform 140ms ease;
}

.task-open-link:hover {
    background: #2b2924;
    transform: translate(-1px, -1px);
}

.task-card-details {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 8px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.task-card-details dt {
    color: var(--ink);
    font-weight: 700;
}

.task-card-details dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 18px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.pagination span {
    border-color: var(--line);
    color: var(--muted);
}

label {
    display: block;
    margin-bottom: 14px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
}

input[type='text'],
input[type='number'],
input[type='file'],
select,
textarea {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 10px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 0;
    background: var(--field);
    color: var(--ink);
    font: inherit;
}

input[type='text']:focus,
input[type='number']:focus,
input[type='file']:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

input[type='number'] {
    display: inline-block;
    max-width: 96px;
}

.actions {
    margin-top: 16px;
}

.progress-meter {
    height: 12px;
    margin: -8px 0 24px;
    border: 1px solid var(--line-strong);
    background: var(--field);
}

.progress-meter span {
    display: block;
    height: 100%;
    background: var(--ink);
}

.task-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.task-heading h1 {
    min-width: 0;
}

.task-heading .icon-button {
    flex: 0 0 auto;
}

.subtask-list {
    display: grid;
    gap: 8px;
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

.subtask-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-height: 52px;
    padding: 7px 8px;
    border: 1px solid var(--line);
    background: var(--paper);
}

.subtask-check,
.subtask-title,
.subtask-rename,
.subtask-controls,
.subtask-controls form {
    margin: 0;
}

.subtask-check label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 15px;
}

.subtask-check span {
    overflow-wrap: anywhere;
}

.subtask-check input[type='checkbox'] {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--ink);
}

.subtask-check input[type='checkbox']:checked + span {
    color: var(--muted);
    text-decoration: line-through;
}

.subtask-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-width: min(70vw, 460px);
    padding: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.subtask-title input[type='text'] {
    margin: 0;
}

.subtask-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
}

.subtask-controls button {
    min-height: 36px;
}

.subtask-title button {
    min-height: 38px;
    padding: 8px 12px;
}

.subtask-rename {
    position: relative;
}

.subtask-rename summary,
.subtask-add-panel summary {
    list-style: none;
}

.subtask-rename summary::-webkit-details-marker,
.subtask-add-panel summary::-webkit-details-marker {
    display: none;
}

.subtask-rename[open] .subtask-title {
    position: absolute;
    z-index: 2;
    right: 0;
    top: calc(100% + 6px);
    box-shadow: 5px 5px 0 var(--ink);
}

.subtask-add {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 280px) auto;
    gap: 12px;
    align-items: end;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    background: var(--paper);
}

.subtask-add label {
    margin: 0;
}

.subtask-add-panel {
    display: inline-block;
}

.subtask-add-panel[open] {
    display: block;
}

.attachment-list {
    display: grid;
    gap: 10px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.attachment-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    background: var(--paper);
}

.attachment-list a {
    overflow-wrap: anywhere;
    font-weight: 700;
}

.attachment-list span {
    color: var(--muted);
    font-size: 13px;
}

.attachment-list form {
    margin: 0;
}

.update-list {
    display: grid;
    gap: 12px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.update-list li {
    padding: 14px;
    border: 1px solid var(--line);
    background: var(--paper);
}

.update-list div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.update-list strong {
    overflow-wrap: anywhere;
}

.update-list small {
    color: var(--muted);
    font-size: 13px;
}

.update-list p {
    margin: 0;
    color: var(--ink);
    overflow-wrap: anywhere;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line-strong);
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--ink);
    background: var(--field);
    font-size: 13px;
}

td {
    color: var(--muted);
}

td:first-child,
td:nth-child(3),
td:nth-child(4) {
    color: var(--ink);
}

td form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
}

@media (max-width: 680px) {
    main {
        width: min(100% - 24px, 1180px);
        margin-top: 20px;
    }

    .login {
        width: min(100% - 24px, 430px);
        margin-top: 10vh;
        padding: 24px;
        box-shadow: 5px 5px 0 var(--ink);
    }

    h1 {
        font-size: 34px;
    }

    .login h1 {
        font-size: 42px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .owner-filter {
        grid-template-columns: 1fr;
    }

    .subtask-list li,
    .subtask-add {
        grid-template-columns: 1fr;
    }

    .subtask-controls {
        justify-content: flex-start;
    }

    .subtask-rename[open] .subtask-title {
        position: static;
        min-width: 0;
        margin-top: 8px;
        box-shadow: none;
    }

    .subtask-title {
        grid-template-columns: 1fr;
    }

    .attachment-list li {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .filters a,
    .button,
    button {
        min-height: 42px;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
