* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Arial', sans-serif;
    background: #fff;
    color: #000;
    min-height: 100vh;
    padding: 10px;
}
h1 { 
    font-weight: 900; 
    font-size: 1.8rem; 
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: -1px;
}
.toolbar {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
button {
    background: #fff;
    color: #000;
    border: 2px solid #000;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.1s;
    -webkit-tap-highlight-color: transparent;
}
button:hover, button:active { background: #000; color: #fff; }
.btn-primary { background: #000; color: #fff; }
.btn-primary:hover, .btn-primary:active { background: #333; }
.btn-small {
    padding: 4px 8px;
    font-size: 11px;
    margin-left: 4px;
}
.btn-delete { background: #fff; color: #000; }
.btn-delete:hover, .btn-delete:active { background: #c00; color: #fff; border-color: #c00; }

/* Drag handle */
.drag-handle {
    cursor: grab;
    padding: 0 6px;
    color: #999;
    font-size: 14px;
    user-select: none;
    display: flex;
    align-items: center;
}
.drag-handle:hover { color: #000; }
.drag-handle:active { cursor: grabbing; }

/* Drag states */
.dragging { opacity: 0.5; }
.drag-over { border-top: 3px solid #000 !important; }

.container { max-width: 700px; margin: 0 auto; }

.category {
    border: 2px solid #000;
    margin-bottom: 10px;
}
.category-header {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: #000;
    color: #fff;
    gap: 6px;
}
.category-header .category-title { flex: 1; }
.category-title {
    font-size: 0.9rem;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    color: #fff;
}
.category-title:hover { text-decoration: underline; }
.category-header button { 
    border-color: #fff; 
    background: transparent; 
    color: #fff; 
}
.category-header button:hover { background: #fff; color: #000; }

/* Category deadline badge */
.category-title .deadline-badge {
    color: #fff;
    border-color: #fff;
    font-size: 9px;
    padding: 1px 5px;
}

/* Category deadline urgency states */
.category.deadline-later .category-header {
    background: #333;
}

.category.deadline-soon .category-header {
    background: repeating-linear-gradient(
        -45deg,
        #000,
        #000 6px,
        #333 6px,
        #333 8px
    );
}

.category.deadline-urgent .category-header {
    background: repeating-linear-gradient(
        -45deg,
        #000,
        #000 4px,
        #555 4px,
        #555 6px
    );
}
.category.deadline-urgent .category-title .deadline-badge {
    background: #fff;
    color: #000;
}

.category.deadline-today .category-header {
    background: repeating-linear-gradient(
        -45deg,
        #000,
        #000 3px,
        #fff 3px,
        #fff 5px
    );
}
.category.deadline-today .category-title {
    background: #000;
    padding: 2px 6px;
}
.category.deadline-today .category-title .deadline-badge {
    background: #fff;
    color: #000;
    border-color: #000;
}

.category.deadline-overdue .category-header {
    background: #fff;
}
.category.deadline-overdue .category-title {
    color: #000;
}
.category.deadline-overdue .drag-handle {
    color: #999;
}
.category.deadline-overdue .drag-handle:hover {
    color: #000;
}
.category.deadline-overdue .category-title .deadline-badge {
    background: #000;
    color: #fff;
    border-color: #000;
}
.category.deadline-overdue .category-header button {
    border-color: #000;
    color: #000;
}
.category.deadline-overdue .category-header button:hover {
    background: #000;
    color: #fff;
}

.project {
    margin: 8px;
    border: 1px solid #ccc;
}
.project-header {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    gap: 6px;
    border-bottom: 1px solid #ccc;
}
.project-header .project-title { flex: 1; }
.project-header .btn-small { opacity: 0; transition: opacity 0.15s; }
.project-header:hover .btn-small { opacity: 1; }
.project-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    color: #000;
}
.project-title:hover { text-decoration: underline; }

/* Project deadline badge */
.project-title .deadline-badge {
    color: #000;
    font-size: 9px;
    padding: 1px 5px;
}

/* Project deadline urgency states */
.project.deadline-later {
    background: #f5f5f5;
}

.project.deadline-soon {
    background: repeating-linear-gradient(
        -45deg,
        #fff,
        #fff 8px,
        #eee 8px,
        #eee 10px
    );
}

.project.deadline-urgent {
    background: repeating-linear-gradient(
        -45deg,
        #fff,
        #fff 4px,
        #ccc 4px,
        #ccc 6px
    );
}
.project.deadline-urgent .project-title .deadline-badge {
    border-width: 2px;
}

.project.deadline-today {
    background: repeating-linear-gradient(
        -45deg,
        #fff,
        #fff 3px,
        #000 3px,
        #000 5px
    );
}
.project.deadline-today .project-header {
    background: #fff;
}
.project.deadline-today .project-title {
    font-weight: 900;
}
.project.deadline-today .project-title .deadline-badge {
    background: #000;
    color: #fff;
    border-color: #000;
}

.project.deadline-overdue {
    background: #000;
    border-color: #000;
}
.project.deadline-overdue .project-header {
    border-bottom-color: #333;
}
.project.deadline-overdue .project-title {
    color: #fff;
    font-weight: 900;
}
.project.deadline-overdue .drag-handle {
    color: #666;
}
.project.deadline-overdue .drag-handle:hover {
    color: #fff;
}
.project.deadline-overdue .project-title .deadline-badge {
    background: #fff;
    color: #000;
    border-color: #fff;
}
.project.deadline-overdue .btn-small {
    border-color: #fff;
    color: #fff;
}
.project.deadline-overdue .btn-small:hover {
    background: #fff;
    color: #000;
}
.project.deadline-overdue .btn-delete:hover {
    background: #c00;
    border-color: #c00;
    color: #fff;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
    gap: 4px;
    min-height: 40px;
}
.todo-item .btn-small { opacity: 0; transition: opacity 0.15s; }
.todo-item:hover .btn-small { opacity: 1; }
.todo-item .btn-edit { opacity: 0; transition: opacity 0.15s; }
.todo-item:hover .btn-edit { opacity: 1; }
.todo-item:last-child { border-bottom: none; }
.todo-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #000;
}
.todo-text {
    flex: 1;
    cursor: pointer;
    font-size: 14px;
}
.todo-text.done {
    text-decoration: line-through;
    color: #999;
}
.todo-children {
    margin-left: 24px;
    border-left: 2px solid #000;
    padding-left: 8px;
}

/* Notes indicator on todo text */
.notes-indicator {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    opacity: 0.5;
    vertical-align: middle;
}

/* Todo wrapper to hold item + expandable notes */
.todo-wrapper {}

/* Notes panel */
.todo-notes {
    display: none;
    padding: 8px 8px 8px 36px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}
.todo-notes.open {
    display: block;
}
.todo-notes textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    border: 1px solid #ccc;
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    background: #fff;
    color: #000;
    box-sizing: border-box;
}
.todo-notes textarea:focus {
    outline: none;
    border-color: #000;
}
.todo-notes-rendered {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.todo-notes-rendered a {
    color: #000;
    font-weight: 700;
    text-decoration: underline;
}
.todo-notes-rendered a:hover {
    background: #000;
    color: #fff;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff;
    padding: 20px;
    border: 3px solid #000;
    min-width: 300px;
    max-width: 90vw;
}
.modal h2 { 
    margin-bottom: 12px; 
    color: #000; 
    font-weight: 900;
    text-transform: uppercase;
}
.modal input, .modal select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 2px solid #000;
    background: #fff;
    color: #000;
    font-size: 14px;
}
.modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Random Activity */
.random-result {
    background: #000;
    color: #fff;
    padding: 16px;
    text-align: center;
    margin-bottom: 12px;
    display: none;
    border: 2px solid #000;
}
.random-result.active { display: block; }
.random-result h3 { margin-bottom: 8px; font-size: 1rem; text-transform: uppercase; }
.random-result p { font-size: 1rem; }
.random-result .category-label { opacity: 0.7; font-size: 0.85rem; margin-top: 6px; }

/* Connection status */
.connection-status {
    position: fixed;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 1000;
    border: 2px solid #000;
}
.connection-status.connected { background: #fff; color: #000; }
.connection-status.disconnected { background: #c00; color: #fff; border-color: #c00; }
.connection-status.connecting { background: #ff0; color: #000; border-color: #000; }

/* Deadline badge */
.deadline-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid currentColor;
    vertical-align: middle;
}

/* Deadline urgency states - brutalist style with stripes */
.todo-item.deadline-later {
    background: #f5f5f5;
}
.todo-item.deadline-later .deadline-badge {
    color: #666;
}

.todo-item.deadline-soon {
    background: repeating-linear-gradient(
        -45deg,
        #fff,
        #fff 8px,
        #eee 8px,
        #eee 10px
    );
}
.todo-item.deadline-soon .deadline-badge {
    color: #333;
    background: #fff;
}

.todo-item.deadline-urgent {
    background: repeating-linear-gradient(
        -45deg,
        #fff,
        #fff 4px,
        #ccc 4px,
        #ccc 6px
    );
}
.todo-item.deadline-urgent .deadline-badge {
    color: #000;
    background: #fff;
    border-width: 2px;
}

.todo-item.deadline-today {
    background: repeating-linear-gradient(
        -45deg,
        #fff,
        #fff 3px,
        #000 3px,
        #000 5px
    );
}
.todo-item.deadline-today .todo-text {
    font-weight: 700;
}
.todo-item.deadline-today .deadline-badge {
    background: #000;
    color: #fff;
    border-color: #000;
}

.todo-item.deadline-overdue {
    background: #000;
}
.todo-item.deadline-overdue .todo-text {
    color: #fff;
    font-weight: 700;
}
.todo-item.deadline-overdue .drag-handle {
    color: #666;
}
.todo-item.deadline-overdue .drag-handle:hover {
    color: #fff;
}
.todo-item.deadline-overdue .deadline-badge {
    background: #fff;
    color: #000;
    border-color: #fff;
}
.todo-item.deadline-overdue .todo-checkbox {
    accent-color: #fff;
}
.todo-item.deadline-overdue .btn-small {
    border-color: #fff;
    color: #fff;
}
.todo-item.deadline-overdue .btn-small:hover {
    background: #fff;
    color: #000;
}
.todo-item.deadline-overdue .btn-delete:hover {
    background: #c00;
    border-color: #c00;
    color: #fff;
}
