* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
        Ubuntu, Cantarell, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 16px;
}

header {
    text-align: center;
    margin-bottom: 24px;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #f0f0f0;
}

/* Input */
#todo-form {
    margin-bottom: 16px;
}

#todo-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #2d2d44;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
    background: #16213e;
    color: #e0e0e0;
}

#todo-input::placeholder {
    color: #666;
}

#todo-input:focus {
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.2);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.tab {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: #2d2d44;
    color: #888;
    transition: all 0.2s;
}

.tab.active {
    background: #4a90d9;
    color: #fff;
}

.tab:hover:not(.active) {
    background: #3a3a55;
}

/* Todo list */
.todo-list {
    list-style: none;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #16213e;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    animation: slideIn 0.2s ease-out;
}

.todo-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); max-height: 80px; }
    to { opacity: 0; transform: translateX(40px); max-height: 0; padding: 0 16px; margin-bottom: 0; }
}

.todo-item.removing {
    animation: fadeOut 0.3s ease-out forwards;
}

.todo-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #4a90d9;
    flex-shrink: 0;
}

.todo-item .todo-text {
    flex: 1;
    font-size: 15px;
    line-height: 1.4;
    color: #e0e0e0;
}

.todo-item.completed-item .todo-text {
    text-decoration: line-through;
    color: #666;
}

.todo-item .todo-time {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 16px;
    color: #666;
    font-size: 15px;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: #1a1a2e;
    border: 1px solid #2d2d44;
    border-radius: 12px;
    padding: 24px;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.modal-close:hover {
    color: #e0e0e0;
}

#detail-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-content h2 {
    font-size: 18px;
    flex: 1;
    padding-right: 24px;
    word-break: break-word;
    color: #f0f0f0;
}

.edit-btn {
    padding: 4px 12px;
    font-size: 13px;
    border: 1px solid #4a90d9;
    background: transparent;
    color: #4a90d9;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.edit-btn:hover {
    background: #4a90d9;
    color: #fff;
}

.edit-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 2px solid #4a90d9;
    border-radius: 6px;
    background: #16213e;
    color: #e0e0e0;
    outline: none;
    margin-bottom: 8px;
}

.edit-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.save-btn {
    padding: 6px 16px;
    font-size: 13px;
    border: none;
    background: #4a90d9;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.cancel-btn {
    padding: 6px 16px;
    font-size: 13px;
    border: 1px solid #444;
    background: transparent;
    color: #aaa;
    border-radius: 4px;
    cursor: pointer;
}

.detail-meta {
    margin-bottom: 16px;
}

.detail-meta p {
    font-size: 14px;
    color: #999;
}

.detail-meta .label {
    font-weight: 600;
    color: #bbb;
}

/* Event log */
.event-log {
    border-top: 1px solid #2d2d44;
    padding-top: 12px;
}

.event-log h3 {
    font-size: 14px;
    font-weight: 600;
    color: #bbb;
    margin-bottom: 8px;
}

.event-log ul {
    list-style: none;
}

.event-log li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    color: #999;
    border-left: 2px solid #2d2d44;
    padding-left: 12px;
    margin-left: 4px;
}

.event-log li:last-child {
    border-left-color: #4a90d9;
}

.event-type {
    font-weight: 600;
    text-transform: capitalize;
    min-width: 80px;
}

.event-type.created { color: #4caf50; }
.event-type.completed { color: #4a90d9; }
.event-type.uncompleted { color: #ff9800; }
.event-type.edited { color: #ce93d8; }
.event-type.synced { color: #26c6da; }

.event-detail {
    color: #777;
    font-style: italic;
}

.event-time {
    margin-left: auto;
    white-space: nowrap;
    color: #555;
    font-size: 12px;
}
